Skip to content

Commit a21f711

Browse files
[16.0][FIX] stock_picking_invoice_link, ensure field product_uom_qty value was changed to raise exception
1 parent 46f39e5 commit a21f711

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

stock_picking_invoice_link/models/stock_move.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from odoo import _, fields, models
77
from odoo.exceptions import UserError
8+
from odoo.tools import float_compare
89

910

1011
class StockMove(models.Model):
@@ -30,7 +31,14 @@ def write(self, vals):
3031
if "product_uom_qty" in vals and not self.env.context.get(
3132
"bypass_stock_move_update_restriction"
3233
):
33-
for move in self:
34+
for move in self.filtered(
35+
lambda x: float_compare(
36+
x.product_uom_qty,
37+
vals.get("product_uom_qty") or 0.0,
38+
precision_rounding=x.product_uom.rounding,
39+
)
40+
!= 0
41+
):
3442
if move.state == "done" and move.invoice_line_ids:
3543
raise UserError(_("You can not modify an invoiced stock move"))
3644
res = super().write(vals)

0 commit comments

Comments
 (0)