Xavier ALT (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-575424-xal into 
lp:openobject-addons/6.1.

Requested reviews:
  Olivier Dony (OpenERP) (odo-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575424-xal/+merge/108322

Hi,

This fix a problem in mrp when trying to generate analytic costs on workcenter 
without a product_id defined.

Steps:
  * create a new db with demo data
  * install 'mrp' module
  * in menu 'Manufacturing / Configuration / Resources / Work Centers', edit 
the "Assembly workshop" work center:
     remove the product defined on the "work center product" field
  * edit the manufacturing order: MO/00005
     - click on "confirm production" button
     - click on "produce" button
     - in the popup, click on "confirm" button

Current: on confirm, we get a traceback
Expected: analytic line should be created without product_id, product_uom_id as 
this are not required.

Cheers,
Xavier
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575424-xal/+merge/108322
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-575424-xal.
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py	2012-02-13 18:07:41 +0000
+++ mrp/mrp.py	2012-06-01 11:48:19 +0000
@@ -799,7 +799,7 @@
                         'ref': wc.code,
                         'product_id': wc.product_id.id,
                         'unit_amount': wc_line.hour,
-                        'product_uom_id': wc.product_id.uom_id.id
+                        'product_uom_id': wc.product_id and wc.product_id.uom_id.id or False
                     } )
             if wc.costs_journal_id and wc.costs_general_account_id:
                 value = wc_line.cycle * wc.costs_cycle
@@ -815,7 +815,7 @@
                         'ref': wc.code,
                         'product_id': wc.product_id.id,
                         'unit_amount': wc_line.cycle,
-                        'product_uom_id': wc.product_id.uom_id.id
+                        'product_uom_id': wc.product_id and wc.product_id.uom_id.id or False
                     } )
         return amount
 

_______________________________________________
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