From c91c3726a7c4805d757f12a031a19830cf6c161f Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Thu, 11 May 2017 11:17:19 +0200 Subject: [PATCH] [FIX] mrp: for the cost calculation and traceability, we need to include all moves When calculating the cost price or the traceability between the consumed and produced quants in a production order, we need to take into account the extra moves that are added in the action_done (move_validate) opw-715541 --- addons/mrp/models/mrp_production.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 968759cd2d5..f77e2c155f4 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -499,11 +499,14 @@ class MrpProduction(models.Model): @api.multi def post_inventory(self): for order in self: + moves_not_to_do = order.move_raw_ids.filtered(lambda x: x.state == 'done') moves_to_do = order.move_raw_ids.filtered(lambda x: x.state not in ('done', 'cancel')) moves_to_do.action_done() + moves_to_do = order.move_raw_ids.filtered(lambda x: x.state == 'done') - moves_not_to_do order._cal_price(moves_to_do) moves_to_finish = order.move_finished_ids.filtered(lambda x: x.state not in ('done','cancel')) moves_to_finish.action_done() + for move in moves_to_finish: #Group quants by lots lot_quants = {}