Skip to content
Snippets Groups Projects
Commit 16a8459a authored by Lucas Perais (lpe)'s avatar Lucas Perais (lpe)
Browse files

[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
parent 2288a895
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment