[FIX] mrp: Missing serial on mass production
Issue : - When mass producing a tracked product, an User Error is raised on validation of splitted MO. Reproduction : - Create Serial storable product "Component A", Lot storable product "Component B", Serial Storable product "Finished Serial Product" - Immediate Transfer 10 * "Component A" and 20 * "Component B" - Create a BoM for "Finished Serial Product", consuming 1 * "Component A" and 2 * "Component B" - Create a Manufacturing Order for 10 * "Finished Serial Product" and Confirm : - Click on "Mass Produce", Set "First SN", Generate all the serials and Apply - Click on "Produce All" Task : 3274962 closes odoo/odoo#118592 Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
@@ -1214,8 +1214,6 @@ class MrpProduction(models.Model):
|
||||
'company_id': self.company_id.id,
|
||||
'name': self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env['ir.sequence'].next_by_code('stock.lot.serial'),
|
||||
})
|
||||
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
|
||||
self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids.lot_id = self.lot_producing_id
|
||||
if self.product_id.tracking == 'serial':
|
||||
self._set_qty_producing()
|
||||
|
||||
@@ -1491,6 +1489,7 @@ class MrpProduction(models.Model):
|
||||
# the finish move can already be completed by the workorder.
|
||||
if finish_moves and not finish_moves.quantity_done:
|
||||
finish_moves._set_quantity_done(float_round(order.qty_producing - order.qty_produced, precision_rounding=order.product_uom_id.rounding, rounding_method='HALF-UP'))
|
||||
if finish_moves.has_tracking != 'none' and order.lot_producing_id:
|
||||
finish_moves.move_line_ids.lot_id = order.lot_producing_id
|
||||
# workorder duration need to be set to calculate the price of the product
|
||||
for workorder in order.workorder_ids:
|
||||
|
||||
Reference in New Issue
Block a user