health register required in purchase
This commit is contained in:
parent
b1ff95cf27
commit
c0e3024e46
11
purchase.py
11
purchase.py
@ -87,7 +87,7 @@ class Line(metaclass=PoolMeta):
|
|||||||
product_equipment = fields.Boolean("Product Equipment",
|
product_equipment = fields.Boolean("Product Equipment",
|
||||||
states={'readonly': True})
|
states={'readonly': True})
|
||||||
software_version = fields.Char("Software version")
|
software_version = fields.Char("Software version")
|
||||||
health_register = fields.Char("Health Register")
|
health_register = fields.Char("Health Register", states={'required': Eval('product_equipment', True)})
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -117,6 +117,12 @@ class Line(metaclass=PoolMeta):
|
|||||||
if self.unit_price:
|
if self.unit_price:
|
||||||
self.unit_price = round_price(self.unit_price)
|
self.unit_price = round_price(self.unit_price)
|
||||||
|
|
||||||
|
@fields.depends('product', 'unit', 'purchase',
|
||||||
|
'_parent_purchase.party', '_parent_purchase.invoice_party',
|
||||||
|
'product_supplier', 'product_equipment',
|
||||||
|
'serial_equipment', 'software_version',
|
||||||
|
'health_register', 'refurbish', methods=['compute_taxes', 'compute_unit_price',
|
||||||
|
'_get_product_supplier_pattern'])
|
||||||
def on_change_product(self):
|
def on_change_product(self):
|
||||||
if not self.product:
|
if not self.product:
|
||||||
self.product_equipment = False
|
self.product_equipment = False
|
||||||
@ -131,7 +137,6 @@ class Line(metaclass=PoolMeta):
|
|||||||
party = None
|
party = None
|
||||||
if self.purchase:
|
if self.purchase:
|
||||||
party = self.purchase.invoice_party or self.purchase.party
|
party = self.purchase.invoice_party or self.purchase.party
|
||||||
|
|
||||||
# Set taxes before unit_price to have taxes in context of purchase
|
# Set taxes before unit_price to have taxes in context of purchase
|
||||||
# price
|
# price
|
||||||
self.taxes = self.compute_taxes(party)
|
self.taxes = self.compute_taxes(party)
|
||||||
@ -155,6 +160,8 @@ class Line(metaclass=PoolMeta):
|
|||||||
if self.product.equipment:
|
if self.product.equipment:
|
||||||
self.product_equipment = True
|
self.product_equipment = True
|
||||||
self.address_equipment = self.default_address_equipment()
|
self.address_equipment = self.default_address_equipment()
|
||||||
|
if self.product.software_required:
|
||||||
|
self.software_version = self.product.software_version
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def view_attributes(cls):
|
def view_attributes(cls):
|
||||||
|
Loading…
Reference in New Issue
Block a user