From daa579c9a3152feac5160c73c06f13b2c49c1bbb Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Wed, 9 Nov 2011 17:19:08 +0530 Subject: [PATCH] [FIX]: purchase: Fixed problem of cancelling PO was not cancelling related procurement, this was a problem of workflow of purchase order lp bug: https://launchpad.net/bugs/868456 fixed bzr revid: rpa@tinyerp.com-20111109114908-oci1p59e636hebsr --- addons/purchase/purchase.py | 5 +++-- addons/purchase/purchase_workflow.xml | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 4c48d971d47..8604775c4f9 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -402,6 +402,7 @@ class purchase_order(osv.osv): return False def action_cancel(self, cr, uid, ids, context=None): + wf_service = netsvc.LocalService("workflow") for purchase in self.browse(cr, uid, ids, context=context): for pick in purchase.picking_ids: if pick.state not in ('draft','cancel'): @@ -409,7 +410,6 @@ class purchase_order(osv.osv): _('Unable to cancel this purchase order!'), _('You must first cancel all receptions related to this purchase order.')) for pick in purchase.picking_ids: - wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr) for inv in purchase.invoice_ids: if inv and inv.state not in ('cancel','draft'): @@ -417,11 +417,12 @@ class purchase_order(osv.osv): _('Unable to cancel this purchase order!'), _('You must first cancel all invoices related to this purchase order.')) if inv: - wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr) self.write(cr,uid,ids,{'state':'cancel'}) + for (id,name) in self.name_get(cr, uid, ids): message = _("Purchase order '%s' is cancelled.") % name + wf_service.trg_validate(uid, 'purchase.order', id, 'purchase_cancel', cr) self.log(cr, uid, id, message) return True diff --git a/addons/purchase/purchase_workflow.xml b/addons/purchase/purchase_workflow.xml index aea6fa2b2ac..c978712c0a1 100644 --- a/addons/purchase/purchase_workflow.xml +++ b/addons/purchase/purchase_workflow.xml @@ -138,12 +138,12 @@ - cancel + purchase_cancel - cancel + purchase_cancel