[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) <whe@odoo.com>
This commit is contained in:
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user