Skip to content

Commit

Permalink
[16.0][FIX] stock_picking_invoice_link, ensure field product_uom_qty …
Browse files Browse the repository at this point in the history
…value was changed to raise exception
  • Loading branch information
ChrisOForgeFlow committed Sep 2, 2024
1 parent 46f39e5 commit a21f711
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion stock_picking_invoice_link/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from odoo import _, fields, models
from odoo.exceptions import UserError
from odoo.tools import float_compare


class StockMove(models.Model):
Expand All @@ -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)
Expand Down

0 comments on commit a21f711

Please sign in to comment.