for move in move_obj.browse(cr, uid, data['form'].get('returns',[])):
move_qty = data['form']['return%s' % move.id]
if (not move_qty) or (move_qty <= 0.0):
- raise wizard.except_wizard(_('Warning !'), _('You cannot return a packing with a product quantity zero or less!'))
+ continue
if not new_picking:
if pick.type in ['out','delivery']:
new_type='in'
new_type='out'
else:
new_type='internal'
- new_picking=pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name,
+ new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name,
'move_lines':[], 'state':'draft', 'type':new_type,
'date':date_cur, 'invoice_state':data['form']['invoice_state'],})
- new_location=move.location_dest_id.id
+ new_location = move.location_dest_id.id
- new_move=move_obj.copy(cr, uid, move.id, {
+ new_move = move_obj.copy(cr, uid, move.id, {
'product_qty': move_qty,
'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id,
move_qty, move.product_uos.id),
if new_picking:
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
pick_obj.force_assign(cr, uid, [new_picking], context)
+ else:
+ raise wizard.except_wizard(_('Warning !'), _('You cannot return a packing with a product quantity zero or less!'))
return new_picking
def _action_open_window(self, cr, uid, data, context):