[FIX] mrp: Manufacturing cost analysis report
Steps to reproduce the bug: - Create a finished product P with a manufacturing BOM B - Set two components on B C1 and C2 - Create a MO with P and process it(plan and produce it) - Unlock the MO and set the consumed qty of C1 to 0 - Lock and click on Mark as Done - Click on Cost Analysis Bug: C1 was displayed in the report with a qty = 1.0 opw:2010912 closes odoo/odoo#34351 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
@@ -6,7 +6,7 @@ from collections import defaultdict
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import AccessError, UserError
|
||||
from odoo.tools import float_compare, float_round
|
||||
from odoo.tools import float_compare, float_round, float_is_zero
|
||||
|
||||
class MrpProduction(models.Model):
|
||||
""" Manufacturing Orders """
|
||||
@@ -667,6 +667,8 @@ class MrpProduction(models.Model):
|
||||
moves_to_do = order.move_raw_ids.filtered(lambda x: x.state not in ('done', 'cancel'))
|
||||
for move in moves_to_do.filtered(lambda m: m.product_qty == 0.0 and m.quantity_done > 0):
|
||||
move.product_uom_qty = move.quantity_done
|
||||
for move in moves_to_do.filtered(lambda m: float_is_zero(m.quantity_done, precision_rounding=m.product_uom.rounding)):
|
||||
move._action_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)
|
||||
|
||||
Reference in New Issue
Block a user