[FIX] mrp: _compute_qty does not exist anymore, so needed to replace
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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'))
|
||||
|
||||
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user