[MERGE] mrp_repair: fixing the bug of operation type onchange, as of revision 8290, in a correct way

bzr revid: qdp-launchpad@openerp.com-20121213124657-6kg85h666gs2ezn2
This commit is contained in:
Quentin (OpenERP)
2012-12-13 13:46:57 +01:00
+4 -2
View File
@@ -729,8 +729,9 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
'location_id': False,
'location_dest_id': False
}}
location_obj = self.pool.get('stock.location')
warehouse_obj = self.pool.get('stock.warehouse')
location_id = self.pool.get('stock.location').search(cr, uid, [('usage','=','production')], context=context)
location_id = location_obj.search(cr, uid, [('usage','=','production')], context=context)
location_id = location_id and location_id[0] or False
if type == 'add':
@@ -748,11 +749,12 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
'location_id': stock_id,
'location_dest_id': location_id
}}
scrap_location_ids = location_obj.search(cr, uid, [('scrap_location', '=', True)], context=context)
return {'value': {
'to_invoice': False,
'location_id': location_id,
'location_dest_id': False
'location_dest_id': scrap_location_ids and scrap_location_ids[0] or False,
}}
mrp_repair_line()