Skip to content

Commit

Permalink
[16.0][FIX] stock_secondary_unit: use @api.model_create_multi in crea…
Browse files Browse the repository at this point in the history
…te method
  • Loading branch information
ced-adhoc committed Oct 16, 2024
1 parent d311024 commit 4b7c76b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions stock_secondary_unit/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ class StockMoveLine(models.Model):
store=True, readonly=False, compute="_compute_qty_done", precompute=True
)

@api.model
def create(self, vals):
move = self.env["stock.move"].browse(vals.get("move_id", False))
if move.secondary_uom_id:
vals["secondary_uom_id"] = move.secondary_uom_id.id
return super().create(vals)
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
move = self.env["stock.move"].browse(vals.get("move_id", False))
if move.secondary_uom_id:
vals["secondary_uom_id"] = move.secondary_uom_id.id
return super().create(vals_list)

@api.depends("secondary_uom_id", "secondary_uom_qty")
def _compute_qty_done(self):
Expand Down

0 comments on commit 4b7c76b

Please sign in to comment.