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

« back to all changes in this revision

Viewing changes to analytic_distribution_supply/purchase.py

  • Committer: Olivier DOSSMANN
  • Date: 2011-12-28 15:38:17 UTC
  • mto: This revision was merged to the branch mainline in revision 492.
  • Revision ID: olivier@tempo-laptop-20111228153817-rd119phuevo66e3y
UF-675 [FIX] Engagement lines deletion when a PO is cancelled.

Show diffs side-by-side

added added

removed removed

Lines of Context:
262
262
 
263
263
    def _finish_commitment(self, cr, uid, ids, context={}):
264
264
        """
265
 
        Delete attached commitment(s) from given Purchase Order.
 
265
        Change commitment(s) to Done state from given Purchase Order.
266
266
        """
267
267
        # Some verifications
268
268
        if not context:
273
273
        for po in self.browse(cr, uid, ids, context=context):
274
274
            # Change commitment state if exists
275
275
            if po.commitment_ids:
276
 
                self.pool.get('account.commitment').write(cr, uid, [x.id for x in po.commitment_ids], {'state': 'done'}, context=context)
 
276
                self.pool.get('account.commitment').action_commitment_done(cr, uid, [x.id for x in po.commitment_ids], context=context)
277
277
        return True
278
278
 
279
279
    def action_cancel(self, cr, uid, ids, context={}):
285
285
            context = {}
286
286
        if isinstance(ids, (int, long)):
287
287
            ids = [ids]
288
 
        # Delete commitments if exists
 
288
        # Change commitments state if exists
289
289
        self._finish_commitment(cr, uid, ids, context=context)
290
290
        return super(purchase_order, self).action_cancel(cr, uid, ids, context=context)
291
291