From f17537d144e5f6aa7972e26fe7fe90380050b75e Mon Sep 17 00:00:00 2001 From: Andrea Piovesana Date: Mon, 3 Feb 2025 17:08:53 +0100 Subject: [PATCH] [FIX] stock_picking_line_sequence: create with api.model_create_multi --- stock_picking_line_sequence/models/stock_move.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/stock_picking_line_sequence/models/stock_move.py b/stock_picking_line_sequence/models/stock_move.py index 69de5fe9e69..0090adc10b4 100644 --- a/stock_picking_line_sequence/models/stock_move.py +++ b/stock_picking_line_sequence/models/stock_move.py @@ -20,11 +20,12 @@ class StockMove(models.Model): store=True, ) - @api.model - def create(self, values): - move = super().create(values) + @api.model_create_multi + def create(self, vals_list): + """(re)initialize the sequences of the moves within a picking""" + moves = super().create(vals_list) # We do not reset the sequence if we are copying a complete picking # or creating a backorder - if not self.env.context.get("keep_line_sequence", False): - move.picking_id._reset_sequence() - return move + if not self.env.context.get("keep_line_sequence"): + moves.picking_id._reset_sequence() + return moves