Xavier ALT (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-57616-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-57616-xal/+merge/113944

Hi,

This fix a problem with Purchase Order workflow, not switching to "cancel" 
activity after confirmation.
Here we trigger workflow 'cancel' transition (which will write state = 
'cancel') instead of only write state == 'cancel'.

Steps:
- Create a SO, add one line with product "CPU1" and choose "Procurement Order = 
on order"
- Confirm the SO
- Run Procurement scheduler (Warehouse > Schedulers > Compute Schedulers)
  (this create a new PO)
- Go to that new PO and confirm it.
- Got to the related reception - and cancel it.
- Then cancel the PO

Current: PO state indicate "cancelled"
         but workflow instance is on "except_picking", "except_invoice"
         and origin procurement is still in "running state"
         and origin SO is still in "Manual in Progress" state
Expected: PO state indicate "cancelled"
          PO workflow in on "cancel" activity
          Procurement is in "Exception" state
          SO is in "Shipping Exception" state

Regards,
Xavier
          
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-57616-xal/+merge/113944
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-57616-xal.
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2012-06-29 14:14:29 +0000
+++ purchase/purchase.py	2012-07-09 10:23:29 +0000
@@ -413,6 +413,7 @@
         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'):
@@ -420,7 +421,6 @@
                         _('Could not cancel purchase order !'),
                         _('You must first cancel all picking attached 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'):
@@ -428,9 +428,8 @@
                         _('Could not cancel this purchase order !'),
                         _('You must first cancel all invoices attached 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'})
+            wf_service.trg_validate(uid, 'purchase.order', purchase.id, 'cancel', cr)
         for (id,name) in self.name_get(cr, uid, ids):
             message = _("Purchase order '%s' is cancelled.") % name
             self.log(cr, uid, id, message)

_______________________________________________
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