[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
This commit is contained in:
Josse Colpaert
2017-05-12 12:24:12 +02:00
committed by Nicolas Martinelli
parent f83f9d702a
commit c91c3726a7
+3
View File
@@ -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 = {}