We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 46f39e5 commit a21f711Copy full SHA for a21f711
stock_picking_invoice_link/models/stock_move.py
@@ -5,6 +5,7 @@
5
6
from odoo import _, fields, models
7
from odoo.exceptions import UserError
8
+from odoo.tools import float_compare
9
10
11
class StockMove(models.Model):
@@ -30,7 +31,14 @@ def write(self, vals):
30
31
if "product_uom_qty" in vals and not self.env.context.get(
32
"bypass_stock_move_update_restriction"
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
+ ):
42
if move.state == "done" and move.invoice_line_ids:
43
raise UserError(_("You can not modify an invoiced stock move"))
44
res = super().write(vals)
0 commit comments