Files
rma/crm_rma_advance_location/wizard/claim_make_picking.py
Joel Grand-Guillaume cd04bb8fb2 [IMP] Split the mass return in a new module
[IMP] Split the new location added on WH in a new module for advance location management
[IMP] Clean the wizards code in crm_claim_rma
[IMP]move wizard in the new module and adapt the view and buttons
2013-11-14 11:07:54 +01:00

57 lines
2.7 KiB
Python

# -*- coding: utf-8 -*-
#########################################################################
# #
# #
#########################################################################
# #
# crm_claim_rma for OpenERP #
# Copyright (C) 2009-2012 Akretion, Emmanuel Samyn, #
# Benoît GUILLOT <benoit.guillot@akretion.com> #
#This program is free software: you can redistribute it and/or modify #
#it under the terms of the GNU General Public License as published by #
#the Free Software Foundation, either version 3 of the License, or #
#(at your option) any later version. #
# #
#This program is distributed in the hope that it will be useful, #
#but WITHOUT ANY WARRANTY; without even the implied warranty of #
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
#GNU General Public License for more details. #
# #
#You should have received a copy of the GNU General Public License #
#along with this program. If not, see <http://www.gnu.org/licenses/>. #
#########################################################################
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
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 = {}
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,
warehouse_id,
['lot_rma_id'],
context=context)['lot_rma_id'][0]
elif context.get('picking_type') == 'loss':
loc_id = warehouse_obj.read(cr, uid,
warehouse_id,
['lot_carrier_loss_id'],
context=context)['lot_carrier_loss_id'][0]
return loc_id
_defaults = {
'claim_line_dest_location': _get_dest_loc,
}