Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
7435f0b2 by Cédric Krier at 2022-12-26T22:39:40+01:00
Set depends on is_valid_product_for_blanket_agreement

Closes #11880
- - - - -


2 changed files:

- modules/purchase_blanket_agreement/purchase.py
- modules/sale_blanket_agreement/sale.py


Changes:

=====================================
modules/purchase_blanket_agreement/purchase.py
=====================================
@@ -788,11 +788,9 @@
                         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
 
@@ -794,8 +792,11 @@
     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


=====================================
modules/sale_blanket_agreement/sale.py
=====================================
@@ -732,11 +732,9 @@
                         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
 
@@ -738,8 +736,11 @@
     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



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/7435f0b28f6e31f1fd1f49f36e4f7046bed75e49

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/7435f0b28f6e31f1fd1f49f36e4f7046bed75e49
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to