diff options
| author | Goffin Simon <sig@odoo.com> | 2019-06-25 09:23:32 +0000 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2019-06-25 09:23:32 +0000 |
| commit | cb4afb263b50b2e7c6ecfc2a57bb3df0dfd0f881 (patch) | |
| tree | 517bca0352fb428ee35711d421437054c9e1fcfd /addons | |
| parent | e628e662719c19c7a9e1b95ffae72d74565dcdee (diff) | |
[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>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/mrp/models/mrp_production.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 3639714366d..7814c1d9133 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -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) |
