details:   https://code.tryton.org/tryton/commit/4023508ccb8b
branch:    7.0
user:      Cédric Krier <[email protected]>
date:      Tue Aug 04 14:43:53 2026 +0200
description:
        Use boolean operator to test remaining quantity of blanket agreement 
when closing

        The remaining quantity may be None if the line has no quantity set.
        But the getter ensure that the remaining quantity is always greater or 
equal to 0.

        Closes #14987
        (grafted from 640dfcc6d6d36f3fbbf8d232c760ea1c560c996d)
diffstat:

 modules/purchase_blanket_agreement/purchase.py |  2 +-
 modules/sale_blanket_agreement/sale.py         |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 545a0db8da50 -r 4023508ccb8b 
modules/purchase_blanket_agreement/purchase.py
--- a/modules/purchase_blanket_agreement/purchase.py    Tue Aug 04 14:34:23 
2026 +0200
+++ b/modules/purchase_blanket_agreement/purchase.py    Tue Aug 04 14:43:53 
2026 +0200
@@ -399,7 +399,7 @@
         cls.set_date(agreements, 'to_date')
         for agreement in agreements:
             if agreement.to_date > today:
-                if any(l.remaining_quantity > 0 for l in agreement.lines):
+                if any(l.remaining_quantity for l in agreement.lines):
                     warning_key = Warning.format(
                             'closed_remaining_quantity', [agreement])
                     if Warning.check(warning_key):
diff -r 545a0db8da50 -r 4023508ccb8b modules/sale_blanket_agreement/sale.py
--- a/modules/sale_blanket_agreement/sale.py    Tue Aug 04 14:34:23 2026 +0200
+++ b/modules/sale_blanket_agreement/sale.py    Tue Aug 04 14:43:53 2026 +0200
@@ -400,7 +400,7 @@
         cls.set_date(agreements, 'to_date')
         for agreement in agreements:
             if agreement.to_date > today:
-                if any(l.remaining_quantity > 0 for l in agreement.lines):
+                if any(l.remaining_quantity for l in agreement.lines):
                     warning_key = Warning.format(
                             'closed_remaining_quantity', [agreement])
                     if Warning.check(warning_key):

Reply via email to