From 93a409daf683b86d70044165e0f506a7700497ef Mon Sep 17 00:00:00 2001 From: sinergia Date: Mon, 4 Jul 2022 16:24:40 -0500 Subject: [PATCH] change values in line of purchase if change product o not product --- purchase.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/purchase.py b/purchase.py index 0c2a427..6b626b5 100644 --- a/purchase.py +++ b/purchase.py @@ -71,11 +71,22 @@ class Line(metaclass=PoolMeta): serial_equipment = fields.Char("Serial", size=None, required=True) refurbish = fields.Boolean("Refurbish") product_equipment = fields.Boolean("Product Equipment") - + @classmethod + def default_address_equipment(cls): + pool = Pool() + Company = pool.get('company.company') + company = Transaction().context.get('company') + if company: + company = Company(company) + return company.party.addresses[0].id + def on_change_product(self): if not self.product: self.product_equipment = False + self.address_equipment = None + self.serial_equipment = None + self.refurbish = None return party = None @@ -104,14 +115,7 @@ class Line(metaclass=PoolMeta): self.amount = self.on_change_with_amount() if self.product.equipment: self.product_equipment = True - - def default_address_equipment(): - pool = Pool() - Company = pool.get('company.company') - company = Transaction().context.get('company') - if company: - company = Company(company) - return company.party.addresses[0].id + self.address_equipment = self.default_address_equipment() @classmethod def view_attributes(cls):