Ravi Gohil (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-579042-rgo into 
lp:openobject-addons/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)
Related bugs:
  Bug #1047680 in OpenERP Addons: "[6.1][mrp_subproduct] module doesn't compare 
the UOM of production vs UOM of sub product"
  https://bugs.launchpad.net/openobject-addons/+bug/1047680

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-579042-rgo/+merge/123737

Hello,

Currently, the conversion from subproduct's UoM(defined in product's BOM menu, 
under `Sub Products` tab) to the UoM defined in manufacturing order isn't 
taking place. It is taking same quantity as in MO.

Please have a look at the detailed steps provided in bug report lp:1047680 for 
better understanding of the issue and to reproduce the issue.

This fix will solve this issue, kindly review the fix.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-579042-rgo/+merge/123737
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-579042-rgo.
=== modified file 'mrp_subproduct/mrp_subproduct.py'
--- mrp_subproduct/mrp_subproduct.py	2012-02-14 15:57:46 +0000
+++ mrp_subproduct/mrp_subproduct.py	2012-09-11 13:05:40 +0000
@@ -79,13 +79,17 @@
             if not production.bom_id:
                 continue
             for sub_product in production.bom_id.sub_products:
+                product_uom_factor = self.pool.get('product.uom')._compute_qty(cr, uid, production.product_uom.id, production.product_qty, production.bom_id.product_uom.id)
                 qty1 = sub_product.product_qty
                 qty2 = production.product_uos and production.product_uos_qty or False
+                product_uos_factor = 0.0
+                if qty2 and production.bom_id.product_uos.id:
+                    product_uos_factor = self.pool.get('product.uom')._compute_qty(cr, uid, production.product_uos.id, production.product_uos_qty, production.bom_id.product_uos.id)
                 if sub_product.subproduct_type == 'variable':
                     if production.product_qty:
-                        qty1 *= production.product_qty / (production.bom_id.product_qty or 1.0)
+                        qty1 *= product_uom_factor * production.product_qty / (production.bom_id.product_qty or 1.0)
                     if production.product_uos_qty:
-                        qty2 *= production.product_uos_qty / (production.bom_id.product_uos_qty or 1.0)
+                        qty2 *= product_uos_factor * production.product_uos_qty / (production.bom_id.product_uos_qty or 1.0)
                 data = {
                     'name': 'PROD:'+production.name,
                     'date': production.date_planned,

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to