From: Quentin (OpenERP) Date: Thu, 13 Dec 2012 11:26:07 +0000 (+0100) Subject: [IMP] mrp_repair: better use a search on scrap location rather than rely on xml_ids... X-Git-Tag: 7.0-server~265^2~10 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;ds=sidebyside;h=154dab3182cf9f4d8d3d5170a5e0000465932d30;p=odoo%2Fodoo.git [IMP] mrp_repair: better use a search on scrap location rather than rely on xml_ids that may refer to removed/deprecated data bzr revid: qdp-launchpad@openerp.com-20121213112607-0gzeu7dpq81dxx3w --- diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 17e9d96..cd78350 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -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,13 +749,12 @@ class mrp_repair_line(osv.osv, ProductChangeMixin): 'location_id': stock_id, 'location_dest_id': location_id }} - obj_data = self.pool.get('ir.model.data') - dummy, scrapped_location_id = obj_data.get_object_reference(cr, uid, 'stock', 'stock_location_scrapped') + 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': scrapped_location_id, + 'location_dest_id': scrap_location_ids and scrap_location_ids[0] or False, }} mrp_repair_line()