Amit Dodiya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-579043-ado into 
lp:openobject-addons/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-579043-ado/+merge/125672

Hello,

[FIX] mrp_subproduct doesnt pull sub products from bill of material when we 
have type phantom"

Issue :
After adding a suproduct line in Bill of matirial of type=Phantom we hope to 
see the material asigned in sub product of phantom bill of material when 
confirming the production order with the parent bill of material that the 
mrp_subproduct fills in finished product, but it doesn't do it.

Steps:
Check this video : http://youtu.be/Fp4Vj5aNtrw

Regards,
Amit Dodiya
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-579043-ado/+merge/125672
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-579043-ado.
=== 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-21 10:50:24 +0000
@@ -78,6 +78,32 @@
             source = production.product_id.product_tmpl_id.property_stock_production.id
             if not production.bom_id:
                 continue
+            datas = {}
+            for bom_lines in production.bom_id.bom_lines:
+                if bom_lines.type == "phantom" and bom_lines.sub_products:
+                    for sub_product_line in bom_lines.sub_products:
+                        qty1 = sub_product_line.product_qty
+                        qty2 = production.product_uos and production.product_uos_qty or False
+                        if sub_product_line.subproduct_type == 'variable':
+                            if production.product_qty:
+                                qty1 *= 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)
+                    datas = {
+                        'name': 'PROD:'+sub_product_line.product_id.name,
+                        'date': production.date_planned,
+                        'product_id': sub_product_line.product_id.id,
+                        'product_qty': qty1,
+                        'product_uom': sub_product_line.product_uom.id,
+                        'product_uos_qty': qty2,
+                        'product_uos': production.product_uos and production.product_uos.id or False,
+                        'location_id': source,
+                        'location_dest_id': production.location_dest_id.id,
+                        'move_dest_id': production.move_prod_id.id,
+                        'state': 'waiting',
+                        'production_id': production.id
+                    }
+                    self.pool.get('stock.move').create(cr, uid, datas)
             for sub_product in production.bom_id.sub_products:
                 qty1 = sub_product.product_qty
                 qty2 = production.product_uos and production.product_uos_qty or False

_______________________________________________
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