From fb0fa8242c78a66622a3e68ff53608d99c0a0b6c Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Thu, 20 Oct 2022 09:43:17 +0200 Subject: [PATCH] Skip check_stock_quantity for sales without warehouse issue11799 review433611003 --- sale.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sale.py b/sale.py index 23376cd7e3..7c4eb4aa52 100644 --- a/sale.py +++ b/sale.py @@ -68,6 +68,9 @@ class Sale(metaclass=PoolMeta): 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 @@ class Line(metaclass=PoolMeta): 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 @@ class Line(metaclass=PoolMeta): 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,