From e83b04a21867459e29f29e48d36efcac5954a740 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Tue, 3 Dec 2013 11:33:50 +0100 Subject: [PATCH] [FIX] loc_id may be empty. unused imports --- .../wizard/claim_make_picking.py | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/crm_rma_advance_location/wizard/claim_make_picking.py b/crm_rma_advance_location/wizard/claim_make_picking.py index ceac72ac..6228e1b0 100644 --- a/crm_rma_advance_location/wizard/claim_make_picking.py +++ b/crm_rma_advance_location/wizard/claim_make_picking.py @@ -20,31 +20,29 @@ #You should have received a copy of the GNU General Public License # #along with this program. If not, see . # ######################################################################### -from openerp.osv import fields, orm, osv -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT -from openerp import netsvc -from openerp.tools.translate import _ -import time +from openerp.osv import orm class claim_make_picking(orm.TransientModel): _inherit = 'claim_make_picking.wizard' - # Get default destination location - def _get_dest_loc(self, cr, uid, context): - res = super(claim_make_picking, self)._get_dest_loc(cr, uid, - context=context) - if context is None: context = {} + def _get_dest_loc(self, cr, uid, context=None): + """ Get default destination location """ + loc_id = super(claim_make_picking, self)._get_dest_loc(cr, uid, context=context) + if context is None: + context = {} warehouse_obj = self.pool.get('stock.warehouse') warehouse_id = context.get('warehouse_id') if context.get('picking_type') == 'in': - loc_id = warehouse_obj.read(cr, uid, + loc_id = warehouse_obj.read( + cr, uid, warehouse_id, ['lot_rma_id'], context=context)['lot_rma_id'][0] elif context.get('picking_type') == 'loss': - loc_id = warehouse_obj.read(cr, uid, + loc_id = warehouse_obj.read( + cr, uid, warehouse_id, ['lot_carrier_loss_id'], context=context)['lot_carrier_loss_id'][0] @@ -53,4 +51,3 @@ class claim_make_picking(orm.TransientModel): _defaults = { 'claim_line_dest_location': _get_dest_loc, } -