health register required in purchase

This commit is contained in:
sinergia 2022-11-09 09:14:25 -05:00
parent b1ff95cf27
commit c0e3024e46

View File

@ -87,7 +87,7 @@ class Line(metaclass=PoolMeta):
product_equipment = fields.Boolean("Product Equipment",
states={'readonly': True})
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
@ -117,6 +117,12 @@ class Line(metaclass=PoolMeta):
if 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):
if not self.product:
self.product_equipment = False
@ -131,7 +137,6 @@ class Line(metaclass=PoolMeta):
party = None
if self.purchase:
party = self.purchase.invoice_party or self.purchase.party
# Set taxes before unit_price to have taxes in context of purchase
# price
self.taxes = self.compute_taxes(party)
@ -155,6 +160,8 @@ class Line(metaclass=PoolMeta):
if self.product.equipment:
self.product_equipment = True
self.address_equipment = self.default_address_equipment()
if self.product.software_required:
self.software_version = self.product.software_version
@classmethod
def view_attributes(cls):