Set depends on is_valid_product_for_blanket_agreement

Closes #11880
This commit is contained in:
Cédric Krier committed 2022-12-26 22:39:40 +01:00
1 parent 16cac27c88
commit 0ae1b367eb
2 files changed
+8 -6

No files matched your search

@@ -788,14 +788,15 @@ class Line(metaclass=PoolMeta):
self.quantity = remaining_quantity
self.on_change_quantity()
@fields.depends(
'blanket_agreement_line', 'product',
'_parent_blanket_agreement_line.product')
@fields.depends(methods=['is_valid_product_for_blanket_agreement'])
def on_change_product(self):
super().on_change_product()
if not self.is_valid_product_for_blanket_agreement():
self.blanket_agreement_line = None
@fields.depends(
'blanket_agreement_line', 'product',
'_parent_blanket_agreement_line.product')
def is_valid_product_for_blanket_agreement(self):
if self.blanket_agreement_line:
return self.product == self.blanket_agreement_line.product
+4 -3
View File
@@ -732,14 +732,15 @@ class Line(metaclass=PoolMeta):
self.quantity = remaining_quantity
self.on_change_quantity()
@fields.depends(
'blanket_agreement_line', 'product',
'_parent_blanket_agreement_line.product')
@fields.depends(methods=['is_valid_product_for_blanket_agreement'])
def on_change_product(self):
super().on_change_product()
if not self.is_valid_product_for_blanket_agreement():
self.blanket_agreement_line = None
@fields.depends(
'blanket_agreement_line', 'product',
'_parent_blanket_agreement_line.product')
def is_valid_product_for_blanket_agreement(self):
if self.blanket_agreement_line:
return self.product == self.blanket_agreement_line.product