[IMP] sale_stock: improve the error message

Currently, User/validation errors are sometimes not correct in English
and/or quite obscure and don't help the user understand/solve the issue.

So in this commit, done some copywriting to make the experience better.

task-2615469

closes odoo/odoo#81711

Related: odoo/enterprise#23013
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
This commit is contained in:
Barad Mahendra
2022-02-14 14:50:53 +00:00
parent 395d150fc7
commit 16614b26fc
+1 -2
View File
@@ -584,6 +584,5 @@ class SaleOrderLine(models.Model):
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
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.'))
raise UserError(_('The ordered quantity cannot be decreased below the amount already delivered. Instead, create a return in your inventory.'))
super(SaleOrderLine, self)._update_line_quantity(values)