Kirti Savalia(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-868456-ksa into 
lp:openobject-addons.

Requested reviews:
  Rucha (Open ERP) (rpa-openerp)
Related bugs:
  Bug #868456 in OpenERP Addons: "[trunk][procurement] Cancel Picking then PO 
leaves Procurement Running"
  https://bugs.launchpad.net/openobject-addons/+bug/868456

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-868456-ksa/+merge/81247

cancel the po,procurement is also cancel.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-868456-ksa/+merge/81247
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-868456-ksa.
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2011-11-01 06:06:29 +0000
+++ purchase/purchase.py	2011-11-04 09:31:25 +0000
@@ -402,6 +402,7 @@
         return False
 
     def action_cancel(self, cr, uid, ids, context=None):
+        procurement_obj = self.pool.get('procurement.order')
         for purchase in self.browse(cr, uid, ids, context=context):
             for pick in purchase.picking_ids:
                 if pick.state not in ('draft','cancel'):
@@ -419,6 +420,12 @@
                 if inv:
                     wf_service = netsvc.LocalService("workflow")
                     wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr)
+
+        #cancel the PO ,procurement is automatically cancel #lp:868456
+        procurement_id = procurement_obj.search(cr, uid, [('purchase_id', '=', ids[0])], context=context)
+        if procurement_id:
+            procurement_obj.write(cr, uid, procurement_id, {'close_move':True})
+            procurement_obj.action_cancel(cr, uid, procurement_id)
         self.write(cr,uid,ids,{'state':'cancel'})
         for (id,name) in self.name_get(cr, uid, ids):
             message = _("Purchase order '%s' is cancelled.") % name

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to