From 16a8459a2ee4527fa344f3c0e6bb0e4358822392 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" <lpe@odoo.com> Date: Tue, 29 May 2018 10:25:56 +0200 Subject: [PATCH] [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 --- addons/sale_mrp/sale_mrp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_mrp/sale_mrp.py b/addons/sale_mrp/sale_mrp.py index d4b7ec04e75f..56e769e1ac47 100644 --- a/addons/sale_mrp/sale_mrp.py +++ b/addons/sale_mrp/sale_mrp.py @@ -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 -- GitLab