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)

--HG--
branch : 8.0
This commit is contained in:
Cédric Krier
2026-08-04 14:43:53 +02:00
parent b20163f6b9
commit dfb345dc86
2 changed files with 2 additions and 2 deletions
@@ -425,7 +425,7 @@ class BlanketAgreement(Workflow, ModelSQL, ModelView, ChatMixin):
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):
+1 -1
View File
@@ -426,7 +426,7 @@ class BlanketAgreement(Workflow, ModelSQL, ModelView, ChatMixin):
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):