Skip to content

Commit

Permalink
Merge PR #1688 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Feb 9, 2025
2 parents 2956123 + a21f711 commit f43d59b
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 f43d59b

Please sign in to comment.