Skip to content
Snippets Groups Projects
Unverified Commit bc23c92c authored by Martin Trigaux's avatar Martin Trigaux
Browse files

[FIX] mrp: avoid empty cost of produced product

If the production flow is in two steps:
1. consume raw material
2. produce manufactured product

The total_consume_moves was empty (so computed cost was 0)

Include the moves that were already consumed since the last production.
This will offer a correct estimation of cost of production in real time for
companies producing in several steps.

opw-675994
parent d5abeb2c
No related branches found
No related tags found
No related merge requests found
......@@ -1011,6 +1011,11 @@ class mrp_production(osv.osv):
total_consume_moves.append(extra_move_id)
if production_mode == 'consume_produce':
# add production lines that have already been consumed since the last 'consume & produce'
last_production_date = production.move_created_ids2 and max(production.move_created_ids2.mapped('date')) or False
already_consumed_lines = production.move_lines2.filtered(lambda l: l.date > last_production_date)
total_consume_moves += already_consumed_lines.ids
price_unit = 0
for produce_product in production.move_created_ids:
is_main_product = (produce_product.product_id.id == production.product_id.id) and production.product_id.cost_method=='real'
......
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