changeset 98b4eeeb7188 in modules/sale_stock_quantity:6.4
details: 
https://hg.tryton.org/modules/sale_stock_quantity?cmd=changeset&node=98b4eeeb7188
description:
        Skip check_stock_quantity for sales without warehouse

        issue11799
        review433611003
        (grafted from 3fa390f939c292a7b92f658ea497056f2a3cfdf5)
diffstat:

 sale.py |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 403842dc5313 -r 98b4eeeb7188 sale.py
--- a/sale.py   Mon May 02 17:45:17 2022 +0200
+++ b/sale.py   Thu Oct 20 09:43:17 2022 +0200
@@ -68,6 +68,9 @@
         Line = pool.get('sale.line')
         Warning = pool.get('res.user.warning')
 
+        if not self.warehouse:
+            return
+
         transaction = Transaction()
 
         def in_group():
@@ -211,6 +214,7 @@
         lang = Lang.get()
         if (self.sale_state == 'draft'
                 and self.sale
+                and self.sale.warehouse
                 and self.product
                 and self.product.type in Move.get_product_types()
                 and self.unit
@@ -219,10 +223,7 @@
                     company=self.company.id if self.company else None):
                 today = Date.today()
             sale_date = self.sale.sale_date or today
-            if self.sale.warehouse:
-                locations = [self.sale.warehouse.id]
-            else:
-                locations = []
+            locations = [self.sale.warehouse.id]
             with Transaction().set_context(
                     locations=locations,
                     stock_date_end=sale_date,

Reply via email to