summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2019-05-03 11:48:01 +0000
committerNicolas Martinelli <nim@odoo.com>2019-05-03 11:48:01 +0000
commitecae2fc9ca319774afc75ecbae5899eb617a971b (patch)
tree76c7ade942ec0e8182c4ab5d0df405b1c977c599 /addons
parent8df4bbf1ed759db18e55b63cd06c500971221a21 (diff)
[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) <nim@odoo.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/sale_stock/models/sale_order.py3
1 files changed, 2 insertions, 1 deletions
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)