← Back to team overview

openerp-india team mailing list archive

[Bug 894624] Re: action_compute: bad UoM computation

 

Tested on:

~openerp/openobject-server/6.0, revno: 3544
~openerp/openobject-addons/6.0, revno: 4933

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/894624

Title:
  action_compute: bad UoM computation

Status in OpenERP Addons (modules):
  New

Bug description:
  Create a new database with demo data, install mrp module.

  Create a new UoM '5kg', equal to 5 kg.
  Set product '[CPU_GEN] Regular processor config' default uom to 'kg'.
  Go to its BoM, and set the BoM UoM to '5kg'.

  That is, to produce 5kg of CPU_GEN, we need 1 CPU1, 1 MB1, etc.

  Now create a new production order of 1 tonne of CPU_GEN and confirm the production order:
  products to consume are not 200 CPU1, 200 MB1, etc like it should be but 5 000 CPU1, etc.

  This is due to line 594 of mrp/mrp.py:
  factor = production.product_qty * production.product_uom.factor_inv / bom_point.product_uom.factor
  5000 = 1 * 1000 (=1/0.001) / 0.2 (=1/5)
  Multiplying by inv_factor + dividing by a factor is like dividing 2 times by a factor which seems quite wrong.

  factor should be the quantity we want to produce expressed in the BoM UoM
  so replace the line by:
  factor = production.product_qty * production.product_uom.factor_inv * bom_point.product_uom.factor
  (or factor = production.product_qty / production.product_uom.factor * bom_point.product_uom.factor)
  just like the function self.pool.get('product.uom')._compute_qty_obj would do:

  amount = qty / from_unit.factor
  if to_unit:
      amount = rounding(amount * to_unit.factor, to_unit.rounding)

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/894624/+subscriptions


References