Skip to content

Commit

Permalink
[IMP] restrict_lot propagation method
Browse files Browse the repository at this point in the history
  • Loading branch information
Kev-Roche committed Aug 21, 2024
1 parent 044018e commit c49b142
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
12 changes: 0 additions & 12 deletions stock_restrict_lot/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,3 @@ def write(self, vals):
)
super(StockMove, chained_moves).write({"restrict_lot_id": restrict_lot_id})
return super().write(vals)

@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)
for move in res:
if not move.restrict_lot_id:
chained_moves = (
move | move.get_all_dest_moves() | move.get_all_orig_moves()
)
if chained_moves.restrict_lot_id:
move.restrict_lot_id = chained_moves.restrict_lot_id[0]
return res
5 changes: 5 additions & 0 deletions stock_restrict_lot/models/stock_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ def _get_custom_move_fields(self):
fields = super()._get_custom_move_fields()
fields += ["restrict_lot_id"]
return fields

def _push_prepare_move_copy_values(self, move_to_copy, new_date):
values = super()._push_prepare_move_copy_values(move_to_copy, new_date)
values["restrict_lot_id"] = move_to_copy.restrict_lot_id.id if move_to_copy.restrict_lot_id else False
return values

0 comments on commit c49b142

Please sign in to comment.