From a21f711f76c522143316ed7e99380dca515ecdc9 Mon Sep 17 00:00:00 2001 From: Christopher Ormaza Date: Fri, 30 Aug 2024 09:09:25 -0500 Subject: [PATCH] [16.0][FIX] stock_picking_invoice_link, ensure field product_uom_qty value was changed to raise exception --- stock_picking_invoice_link/models/stock_move.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/stock_picking_invoice_link/models/stock_move.py b/stock_picking_invoice_link/models/stock_move.py index 8626ac1a76b8..e50e01bdc586 100644 --- a/stock_picking_invoice_link/models/stock_move.py +++ b/stock_picking_invoice_link/models/stock_move.py @@ -5,6 +5,7 @@ from odoo import _, fields, models from odoo.exceptions import UserError +from odoo.tools import float_compare class StockMove(models.Model): @@ -30,7 +31,14 @@ def write(self, vals): if "product_uom_qty" in vals and not self.env.context.get( "bypass_stock_move_update_restriction" ): - for move in self: + for move in self.filtered( + lambda x: float_compare( + x.product_uom_qty, + vals.get("product_uom_qty") or 0.0, + precision_rounding=x.product_uom.rounding, + ) + != 0 + ): if move.state == "done" and move.invoice_line_ids: raise UserError(_("You can not modify an invoiced stock move")) res = super().write(vals)