correction to wizard for create contract
This commit is contained in:
parent
b3e07eff1b
commit
ea6d5ebcbd
@ -25,6 +25,7 @@ def register():
|
|||||||
contract.Contract,
|
contract.Contract,
|
||||||
contract.ContractMaintenanceServices,
|
contract.ContractMaintenanceServices,
|
||||||
contract.ContractEquipment,
|
contract.ContractEquipment,
|
||||||
|
contract.CreateContractInitial,
|
||||||
party.Address,
|
party.Address,
|
||||||
party.Party,
|
party.Party,
|
||||||
product.Template,
|
product.Template,
|
||||||
@ -49,6 +50,7 @@ def register():
|
|||||||
Pool.register(
|
Pool.register(
|
||||||
agended.AssingAgended,
|
agended.AssingAgended,
|
||||||
agended.ReAssingAgended,
|
agended.ReAssingAgended,
|
||||||
|
contract.CreateContract,
|
||||||
equipment.NewPropietary,
|
equipment.NewPropietary,
|
||||||
maintenance.NewPropietaryMaintenance,
|
maintenance.NewPropietaryMaintenance,
|
||||||
module='optical_equipment', type_='wizard')
|
module='optical_equipment', type_='wizard')
|
||||||
|
19
contract.py
19
contract.py
@ -225,6 +225,13 @@ class CreateContractInitial(ModelView, ModelSQL):
|
|||||||
def default_company():
|
def default_company():
|
||||||
return Transaction().context.get('company')
|
return Transaction().context.get('company')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def default_currency():
|
||||||
|
Company = Pool().get('company.company')
|
||||||
|
if Transaction().context.get('company'):
|
||||||
|
company = Company(Transaction().context['company'])
|
||||||
|
return company.currency.id
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_start_date(cls):
|
def default_start_date(cls):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
@ -238,7 +245,7 @@ class CreateContractInitial(ModelView, ModelSQL):
|
|||||||
Date = pool.get('ir.date')
|
Date = pool.get('ir.date')
|
||||||
if self.party:
|
if self.party:
|
||||||
self.invoice_address = self.party.address_get(type='invoice')
|
self.invoice_address = self.party.address_get(type='invoice')
|
||||||
if self.party.client_type == "ips":
|
if self.party.customer_type == "ips":
|
||||||
self.end_date = Date.today() + timedelta(days=182)
|
self.end_date = Date.today() + timedelta(days=182)
|
||||||
else:
|
else:
|
||||||
self.end_date = Date.today() + timedelta(days=365)
|
self.end_date = Date.today() + timedelta(days=365)
|
||||||
@ -255,6 +262,16 @@ class CreateContract(Wizard):
|
|||||||
create_contract = StateAction('optical_equipment.act_contract_form')
|
create_contract = StateAction('optical_equipment.act_contract_form')
|
||||||
|
|
||||||
|
|
||||||
|
def default_start(self, fields):
|
||||||
|
if self.record:
|
||||||
|
default = {'party': self.record.propietary.id,
|
||||||
|
'invoice_address': self.record.propietary_address.id,
|
||||||
|
'unit_price': (self.record.sale_origin.amount
|
||||||
|
if self.record.sale_origin.__name__ == "sale.line"
|
||||||
|
else self.record.sale_origin.total_amount),
|
||||||
|
}
|
||||||
|
return default
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _subscription_start(self):
|
def _subscription_start(self):
|
||||||
return dict(
|
return dict(
|
||||||
|
@ -1346,6 +1346,10 @@ msgctxt "field:optical_equipment_create.contract,end_date:"
|
|||||||
msgid "End Date"
|
msgid "End Date"
|
||||||
msgstr "Fecha Final"
|
msgstr "Fecha Final"
|
||||||
|
|
||||||
|
msgctxt "field:optical_equipment_create.contract,unit_price:"
|
||||||
|
msgid "Unit Price"
|
||||||
|
msgstr "Precio Unitario"
|
||||||
|
|
||||||
msgctxt "field:stock.move,equipment:"
|
msgctxt "field:stock.move,equipment:"
|
||||||
msgid "Equipment"
|
msgid "Equipment"
|
||||||
msgstr "Equipo"
|
msgstr "Equipo"
|
||||||
|
Loading…
Reference in New Issue
Block a user