51
51
#TODO use custom states to show buttons of this wizard or not instead of raise an error
52
52
if context is None: context = {}
53
53
line_obj = self.pool.get('claim.line')
54
if context.get('picking_type') in ['in', 'loss']:
54
if context.get('picking_type') == 'out':
55
move_field = 'move_out_id'
55
57
move_field = 'move_in_id'
56
elif context.get('picking_type') == 'out':
57
move_field = 'move_out_id'
59
59
line_ids = line_obj.search(cr, uid,
60
60
[('claim_id', '=', context['active_id'])], context=context)
79
79
context=context)['lot_stock_id'][0]
80
elif (context.get('picking_type') in ['in', 'loss']
81
and context.get('partner_id')):
80
elif context.get('partner_id'):
82
81
loc_id = self.pool.get('res.partner').read(cr, uid,
83
82
context['partner_id'],
84
83
['property_stock_customer'],
90
89
if context is None: context = {}
91
90
warehouse_obj = self.pool.get('stock.warehouse')
92
91
warehouse_id = context.get('warehouse_id')
93
if context.get('picking_type') == 'out':
93
if context.get('picking_type') == 'out' and context.get('partner_id'):
94
94
loc_id = self.pool.get('res.partner').read(cr, uid,
95
95
context.get('partner_id'),
96
96
['property_stock_customer'],
97
97
context=context)['property_stock_customer'][0]
98
elif context.get('picking_type') == 'in':
98
elif context.get('picking_type') == 'in' and context.get('partner_id'):
99
99
loc_id = warehouse_obj.read(cr, uid,
102
context=context)['lot_rma_id'][0]
103
elif context.get('picking_type') == 'loss':
104
loc_id = warehouse_obj.read(cr, uid,
106
['lot_carrier_loss_id'],
107
context=context)['lot_carrier_loss_id'][0]
102
context=context)['lot_stock_id'][0]
103
# Add the case of return to supplier !
121
117
picking_obj = self.pool.get('stock.picking')
122
118
if context is None: context = {}
123
119
view_obj = self.pool.get('ir.ui.view')
124
if context.get('picking_type') in ['in', 'loss']:
126
view_xml_id = 'stock_picking_form'
127
view_name = 'stock.picking.form'
128
write_field = 'move_in_id'
129
if context.get('picking_type') == 'in':
130
note = 'RMA picking in'
131
name = 'Customer picking in'
132
elif context.get('picking_type') == 'loss':
133
name = 'Customer product loss'
134
note = 'RMA product loss'
135
elif context.get('picking_type') == 'out':
120
if context.get('picking_type') == 'out':
137
122
write_field = 'move_out_id'
138
123
note = 'RMA picking out'
139
124
name = 'Customer picking out'
140
125
view_xml_id = 'stock_picking_form'
141
126
view_name = 'stock.picking.form'
129
view_xml_id = 'stock_picking_form'
130
view_name = 'stock.picking.form'
131
write_field = 'move_in_id'
132
if context.get('picking_type'):
133
note = 'RMA picking ' + str(context.get('picking_type'))
142
134
view_id = view_obj.search(cr, uid, [
143
135
('xml_id', '=', view_xml_id),
144
136
('model', '=', 'stock.picking'),