From 768a2e438f2a02a4206c177ae30b8ff1968775e0 Mon Sep 17 00:00:00 2001 From: "Cyril Dutrieux (cydu)" Date: Mon, 9 Jan 2023 11:30:31 +0000 Subject: [PATCH] [FIX] purchase: Prevents logging a qty update when qty isn't updated closes odoo/odoo#110905 X-original-commit: dbf526ba37e0e34a569aee079e4cd65b24a6d6d0 Signed-off-by: William Henrotin (whe) --- addons/purchase/models/purchase.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index 602c50fa92a..3314e33cff7 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -1096,13 +1096,18 @@ class PurchaseOrderLine(models.Model): raise UserError(_("You cannot change the type of a purchase order line. Instead you should delete the current line and create a new line of the proper type.")) if 'product_qty' in values: + precision = self.env['decimal.precision'].precision_get('Product Unit of Measure') for line in self: - if line.order_id.state == 'purchase': + if ( + line.order_id.state == "purchase" + and float_compare(line.product_qty, values["product_qty"], precision_digits=precision) != 0 + ): line.order_id.message_post_with_source( 'purchase.track_po_line_template', render_values={'line': line, 'product_qty': values['product_qty']}, subtype_xmlid='mail.mt_note', ) + if 'qty_received' in values: for line in self: line._track_qty_received(values['qty_received'])