details:   https://code.tryton.org/tryton/commit/f21002c5cb18
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Oct 30 01:11:22 2025 +0100
description:
        Test from location when checking warehouse for purchase line with 
negative quantity

        Closes #14333
diffstat:

 modules/purchase/purchase.py |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (18 lines):

diff -r e83d269d3f80 -r f21002c5cb18 modules/purchase/purchase.py
--- a/modules/purchase/purchase.py      Thu Oct 30 00:59:07 2025 +0100
+++ b/modules/purchase/purchase.py      Thu Oct 30 01:11:22 2025 +0100
@@ -759,9 +759,11 @@
 
     def check_for_quotation(self):
         for line in self.line_lines:
-            if (not line.to_location
-                    and line.product
-                    and line.movable):
+            if (line.quantity or 0) >= 0:
+                location = line.to_location
+            else:
+                location = line.from_location
+            if ((not location or not line.warehouse) and line.movable):
                 raise PurchaseQuotationError(
                     gettext('purchase.msg_warehouse_required_for_quotation',
                         purchase=self.rec_name))

Reply via email to