Mayur Maheshwari(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-opw-579042-port-mma into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-579042-port-mma/+merge/135879
Hello,
Currently, the conversion from by-product'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 and to reproduce the issue.
code is forward port from 6.1
Thanks,
Mayur
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-579042-port-mma/+merge/135879
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-opw-579042-port-mma.
=== modified file 'mrp_byproduct/mrp_byproduct.py'
--- mrp_byproduct/mrp_byproduct.py 2012-10-16 04:39:15 +0000
+++ mrp_byproduct/mrp_byproduct.py 2012-11-23 12:13:23 +0000
@@ -86,18 +86,23 @@
@return: Newly generated picking Id.
"""
picking_id = super(mrp_production,self).action_confirm(cr, uid, ids)
+ product_uom_obj = self.pool.get('product.uom')
for production in self.browse(cr, uid, ids):
source = production.product_id.product_tmpl_id.property_stock_production.id
if not production.bom_id:
continue
for sub_product in production.bom_id.sub_products:
+ product_uom_factor = product_uom_obj._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 = product_uom_obj._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.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.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