From 4ee5b4bedae693d4c9e338b0f9a53b540cff9441 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Wed, 24 Aug 2011 13:31:51 +0530 Subject: [PATCH] [FIX] mrp_repair:Hardcoded stock name location in mrp_repair are removed lp bug: https://launchpad.net/bugs/831543 fixed bzr revid: aag@tinyerp.com-20110824080151-3hnce2cgz6600gy8 --- addons/mrp_repair/mrp_repair.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 3a538590d10..548c95ffa1c 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -699,7 +699,7 @@ class mrp_repair_line(osv.osv, ProductChangeMixin): } } - 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 @@ class mrp_repair_line(osv.osv, ProductChangeMixin): '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()