summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosse Colpaert <jco@odoo.com>2016-10-02 19:35:43 +0200
committerJosse Colpaert <jco@odoo.com>2016-10-02 21:14:37 +0200
commit59c410ac5cbb8e33bc140af4a4fede2f80c0da8f (patch)
tree684cabd6d343df17f0f89739e6cc44dd8ec70a16
parent831baf7dd20dd4aca9117cf4b2566391f45e7e39 (diff)
[FIX] mrp: _compute_qty does not exist anymore, so needed to replace
-rw-r--r--addons/mrp/report/mrp_bom_cost_report.py2
-rw-r--r--addons/mrp/wizard/change_production_qty.py5
-rw-r--r--addons/mrp_byproduct/wizard/change_production_qty.py4
3 files changed, 5 insertions, 6 deletions
diff --git a/addons/mrp/report/mrp_bom_cost_report.py b/addons/mrp/report/mrp_bom_cost_report.py
index 93ae3ad64e1..cbbdf935497 100644
--- a/addons/mrp/report/mrp_bom_cost_report.py
+++ b/addons/mrp/report/mrp_bom_cost_report.py
@@ -26,7 +26,7 @@ class MrpBomCost(models.AbstractModel):
'attributes': attributes}
total = 0.0
for bom_line, line_data in result2:
- price_uom = self.env['product.uom']._compute_qty(bom_line.product_id.uom_id.id, bom_line.product_id.standard_price, bom_line.product_uom_id.id)
+ price_uom = bom_line.product_uom_id._compute_quantity(bom_line.product_id.standard_price, bom_line.product_uom_id)
line = {
'product_id': bom_line.product_id,
'product_uom_qty': line_data['qty'], #line_data needed for phantom bom explosion
diff --git a/addons/mrp/wizard/change_production_qty.py b/addons/mrp/wizard/change_production_qty.py
index 0e44ba0e6f7..fd299d90eb7 100644
--- a/addons/mrp/wizard/change_production_qty.py
+++ b/addons/mrp/wizard/change_production_qty.py
@@ -43,14 +43,13 @@ class ChangeProductionQty(models.TransientModel):
if wizard.product_qty < produced:
raise UserError(_("You have already processed %d. Please input a quantity higher than %d ")%(produced, produced))
production.write({'product_qty': wizard.product_qty})
- bom_point = production.bom_id
- factor = self.env['product.uom']._compute_qty(production.product_uom_id.id, production.product_qty - production.qty_produced, production.bom_id.product_uom_id.id) / production.bom_id.product_qty
+ factor = production.product_uom_id._compute_quantity(production.product_qty - production.qty_produced, production.bom_id.product_uom_id) / production.bom_id.product_qty
boms, lines = production.bom_id.explode(production.product_id, factor, picking_type=production.bom_id.picking_type_id)
for line, line_data in lines:
production._update_raw_move(line, line_data)
operation_bom_qty = {}
for bom, bom_data in boms:
- for operation in bom.routing.operation_ids:
+ for operation in bom.routing_id.operation_ids:
operation_bom_qty[operation.id] = bom_data['qty']
self._update_product_to_produce(production, production.product_qty - production.qty_produced)
moves = production.move_raw_ids.filtered(lambda x: x.state not in ('done', 'cancel'))
diff --git a/addons/mrp_byproduct/wizard/change_production_qty.py b/addons/mrp_byproduct/wizard/change_production_qty.py
index 1ac4b74f867..aaec431c6f3 100644
--- a/addons/mrp_byproduct/wizard/change_production_qty.py
+++ b/addons/mrp_byproduct/wizard/change_production_qty.py
@@ -13,9 +13,9 @@ class ChangeProductionQty(models.TransientModel):
Production = self.env['mrp.production']
UoM = self.env['product.uom']
for sub_product_line in prod.bom_id.sub_products:
- move = prod.move_finished_ids.filtered(lambda x: x.sub_product_id == sub_product_line and x.state not in ('done', 'cancel'))
+ move = prod.move_finished_ids.filtered(lambda x: x.subproduct_id == sub_product_line and x.state not in ('done', 'cancel'))
if move:
- product_uom_factor = UoM._compute_qty_obj(prod.product_uom_id, prod.product_qty - prod.qty_produced, prod.bom_id.product_uom_id)
+ product_uom_factor = prod.product_uom_id._compute_quantity(prod.product_qty - prod.qty_produced, prod.bom_id.product_uom_id)
qty1 = sub_product_line.product_qty
qty1 *= product_uom_factor / prod.bom_id.product_qty
move[0].write({'product_uom_qty': qty1})