[FIX] purchase: at unlink force removal of concurrency-info, record modified by force...
authorXavier ALT <xal@openerp.com>
Fri, 4 May 2012 14:07:48 +0000 (16:07 +0200)
committerXavier ALT <xal@openerp.com>
Fri, 4 May 2012 14:07:48 +0000 (16:07 +0200)
bzr revid: xal@openerp.com-20120504140748-sb7d7axi27hjodtn

addons/purchase/purchase.py

index 0767e20..726fffa 100644 (file)
@@ -249,6 +249,10 @@ class purchase_order(osv.osv):
         wf_service = netsvc.LocalService("workflow")
         for id in unlink_ids:
             wf_service.trg_validate(uid, 'purchase.order', id, 'purchase_cancel', cr)
+        # force removal on concurrency-check field from context because
+        # system will raise an error if record was modified by workflow
+        if context and unlink_ids:
+            context.pop(self.CONCURRENCY_CHECK_FIELD, None)
 
         return super(purchase_order, self).unlink(cr, uid, unlink_ids, context=context)