From ecae2fc9ca319774afc75ecbae5899eb617a971b Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 3 May 2019 11:48:01 +0000 Subject: [PATCH] [FIX] sale_stock: scope of warning The check on the ordered quantity should not apply to services. opw-1981332 closes odoo/odoo#33138 Signed-off-by: Nicolas Martinelli (nim) --- addons/sale_stock/models/sale_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index 41cd9b7ccc6..51c1d66a606 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -446,7 +446,8 @@ class SaleOrderLine(models.Model): def _update_line_quantity(self, values): precision = self.env['decimal.precision'].precision_get('Product Unit of Measure') - if self.mapped('qty_delivered') and float_compare(values['product_uom_qty'], max(self.mapped('qty_delivered')), precision_digits=precision) == -1: + line_products = self.filtered(lambda l: l.product_id.type in ['product', 'consu']) + if line_products.mapped('qty_delivered') and float_compare(values['product_uom_qty'], max(line_products.mapped('qty_delivered')), precision_digits=precision) == -1: raise UserError(_('You cannot decrease the ordered quantity below the delivered quantity.\n' 'Create a return first.')) super(SaleOrderLine, self)._update_line_quantity(values)