[FIX] sale: do not track quantity change if product changed too

Customer should do it in two steps if that's really what they want to do.
This custom log was mainly intended to follow quantity changes on confirmed
orders, but it's plain wrong if the product is changed at the same time.

opw-3432715

closes odoo/odoo#142610

X-original-commit: dd526d049be27ac4852ac0eeaca04c3a2a36c39b
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Victor Feyens
2023-11-21 09:21:16 +00:00
parent 1e27f665d4
commit fe82085f22
+3
View File
@@ -1033,6 +1033,9 @@ class SaleOrderLine(models.Model):
order_lines = self.filtered(lambda x: x.order_id == order)
msg = Markup("<b>%s</b><ul>") % _("The ordered quantity has been updated.")
for line in order_lines:
if 'product_id' in values and values['product_id'] != line.product_id.id:
# tracking is meaningless if the product is changed as well.
continue
msg += Markup("<li> %s: <br/>") % line.product_id.display_name
msg += _(
"Ordered Quantity: %(old_qty)s -> %(new_qty)s",