Reset price list when company is changed

issue10540
review352251002
This commit is contained in:
Cédric Krier committed 2021-07-07 00:42:25 +02:00
1 parent 98684392b6
commit 1e2c72879d
1 file changed
+13
+13
View File
@@ -41,6 +41,19 @@ class Sale(metaclass=PoolMeta):
'sale_price_list',
company=self.company.id if self.company else None)
@fields.depends('party')
def on_change_company(self):
pool = Pool()
Configuration = pool.get('sale.configuration')
super().on_change_company()
if self.party and self.party.sale_price_list:
self.price_list = self.party.sale_price_list
else:
config = Configuration(1)
self.price_list = config.get_multivalue(
'sale_price_list',
company=self.company.id if self.company else None)
class Line(metaclass=PoolMeta):
__name__ = 'sale.line'