~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to delivery_mechanism/wizard/enter_reason.py

  • Committer: jf
  • Date: 2014-09-05 08:53:44 UTC
  • mfrom: (2206.3.39 unifield-wm)
  • Revision ID: jfb@tempo-consulting.fr-20140905085344-n3iz6igxpmo0yfht
Tags: pilot3.1b7
Pilot 3.1b7

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        for obj in picking_obj.browse(cr, uid, picking_ids, context=context):
66
66
            # purchase order line to re-source
67
67
            pol_ids = []
 
68
            pol_qty = {}
68
69
            # set the reason
69
70
            obj.write({'change_reason': change_reason}, context=context)
70
71
 
71
72
            for move in obj.move_lines:
72
 
                pol_ids.append(move.purchase_line_id.id)
 
73
                if move.state != 'cancel':
 
74
                    pol_ids.append(move.purchase_line_id.id)
 
75
                    pol_qty.setdefault(move.purchase_line_id.id, 0.00)
 
76
                    pol_qty[move.purchase_line_id.id] += move.product_qty
73
77
 
74
78
            # if full cancel (no resource), we updated corresponding out and correct po state
75
79
            if cancel_type == 'update_out':
76
80
                picking_obj.cancel_and_update_out(cr, uid, [obj.id], context=context)
77
81
            else:
 
82
                context['pol_qty'] = pol_qty
78
83
                pol_obj.write(cr, uid, pol_ids, {'has_to_be_resourced': True}, context=context)
79
84
                pol_obj.cancel_sol(cr, uid, pol_ids, context=context)
80
85