Xavier ALT (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-17580-xal into 
lp:openobject-addons/6.0.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-17580-xal/+merge/104757

Hi,

This fix a problem when trying to delete a "draft" Purchase Order from the web 
client (which is sending CONCURRENCY_INFO).

The unlink method of Purchase Order is forcing the workflow transition to 
"purchase_cancel" before unlink them, if client send CONCURRENCY_INFO, ORM will 
raise and error because the records has been modified in the meanwhile.

As the problem happen only the that specific case, I simply remove 
CONCURRENCY_INFO info here.

Regards,
Xavier
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-17580-xal/+merge/104757
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-17580-xal.
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2012-03-20 10:37:52 +0000
+++ purchase/purchase.py	2012-05-04 15:15:25 +0000
@@ -249,6 +249,10 @@
         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)
 

_______________________________________________
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