change values in line of purchase if change product o not product
This commit is contained in:
parent
5e820d5670
commit
93a409daf6
22
purchase.py
22
purchase.py
@ -71,11 +71,22 @@ class Line(metaclass=PoolMeta):
|
|||||||
serial_equipment = fields.Char("Serial", size=None, required=True)
|
serial_equipment = fields.Char("Serial", size=None, required=True)
|
||||||
refurbish = fields.Boolean("Refurbish")
|
refurbish = fields.Boolean("Refurbish")
|
||||||
product_equipment = fields.Boolean("Product Equipment")
|
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):
|
def on_change_product(self):
|
||||||
if not self.product:
|
if not self.product:
|
||||||
self.product_equipment = False
|
self.product_equipment = False
|
||||||
|
self.address_equipment = None
|
||||||
|
self.serial_equipment = None
|
||||||
|
self.refurbish = None
|
||||||
return
|
return
|
||||||
|
|
||||||
party = None
|
party = None
|
||||||
@ -104,14 +115,7 @@ class Line(metaclass=PoolMeta):
|
|||||||
self.amount = self.on_change_with_amount()
|
self.amount = self.on_change_with_amount()
|
||||||
if self.product.equipment:
|
if self.product.equipment:
|
||||||
self.product_equipment = True
|
self.product_equipment = True
|
||||||
|
self.address_equipment = self.default_address_equipment()
|
||||||
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
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def view_attributes(cls):
|
def view_attributes(cls):
|
||||||
|
Loading…
Reference in New Issue
Block a user