[FIX] sale_mrp: allow production without finished products
Have a mrp.production that you cancel, and delete the finished products lines Before this commit, the computation of the sale_name crashed because we did an index selection on an empty recordset After this commit, there is no crash opw 1851217 closes #24923
This commit is contained in:
@@ -18,7 +18,7 @@ class MrpProduction(models.Model):
|
||||
return get_parent_move(move.move_dest_id)
|
||||
return move
|
||||
for production in self:
|
||||
move = get_parent_move(production.move_finished_ids[0])
|
||||
move = get_parent_move(production.move_finished_ids[:1])
|
||||
production.sale_name = move.procurement_id and move.procurement_id.sale_line_id and move.procurement_id.sale_line_id.order_id.name or False
|
||||
production.sale_ref = move.procurement_id and move.procurement_id.sale_line_id and move.procurement_id.sale_line_id.order_id.client_order_ref or False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user