Atik Agewan(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-831543-aag into 
lp:openobject-addons.

Requested reviews:
  Rucha (Open ERP) (rpa-openerp)
Related bugs:
  Bug #831543 in OpenERP Addons: "V6.02 . Hardcoded stock name location in 
mrp_repair "
  https://bugs.launchpad.net/openobject-addons/+bug/831543

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-831543-aag/+merge/72686


Hello,

 mrp_repair:Hardcoded stock name location in mrp_repair are removed ' 

Thanks
 AAG

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-831543-aag/+merge/72686
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-831543-aag.
=== modified file 'mrp_repair/mrp_repair.py'
--- mrp_repair/mrp_repair.py	2011-08-15 14:21:41 +0000
+++ mrp_repair/mrp_repair.py	2011-08-24 08:46:35 +0000
@@ -699,7 +699,7 @@
                 }
             }
 
-        product_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Production')])[0]
+        product_id = self.pool.get('stock.location').search(cr, uid, [('usage','=','production')])[0]
         if type != 'add':
             return {'value': {
                 'to_invoice': False,
@@ -707,15 +707,16 @@
                 'location_dest_id': False
                 }
             }
-
-        stock_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Stock')])[0]
-        to_invoice = (guarantee_limit and
-                      datetime.strptime(guarantee_limit, '%Y-%m-%d') < datetime.now())
-        return {'value': {
-            'to_invoice': to_invoice,
-            'location_id': stock_id,
-            'location_dest_id': product_id
-            }
+            
+        if ids:
+            stock_id = self.browse(cr, uid, ids[0]).repair_id.company_id.partner_id.property_stock_customer.id
+            to_invoice = (guarantee_limit and
+                          datetime.strptime(guarantee_limit, '%Y-%m-%d') < datetime.now())
+            return {'value': {
+                'to_invoice': to_invoice,
+                'location_id': stock_id,
+                'location_dest_id': product_id
+                }
         }
 
 mrp_repair_line()

_______________________________________________
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