Merge lp:~openerp-dev/openobject-addons/6.0-opw-57616-xal into lp:openobject-addons/6.0

Proposed by Xavier ALT
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-57616-xal
Merge into: lp:openobject-addons/6.0
Diff against target: 30 lines (+2/-3)
1 file modified
purchase/purchase.py (+2/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-57616-xal
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+113944@code.launchpad.net

Description of the change

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

To post a comment you must log in.

Unmerged revisions

5287. By Xavier ALT

[FIX] purchase: trigger workflow 'cancel' on PO cancellation otherwise PO workflow stay on except_picking/except_invoice

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'purchase/purchase.py'
2--- purchase/purchase.py 2012-06-29 14:14:29 +0000
3+++ purchase/purchase.py 2012-07-09 10:23:29 +0000
4@@ -413,6 +413,7 @@
5 return False
6
7 def action_cancel(self, cr, uid, ids, context=None):
8+ wf_service = netsvc.LocalService("workflow")
9 for purchase in self.browse(cr, uid, ids, context=context):
10 for pick in purchase.picking_ids:
11 if pick.state not in ('draft','cancel'):
12@@ -420,7 +421,6 @@
13 _('Could not cancel purchase order !'),
14 _('You must first cancel all picking attached to this purchase order.'))
15 for pick in purchase.picking_ids:
16- wf_service = netsvc.LocalService("workflow")
17 wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
18 for inv in purchase.invoice_ids:
19 if inv and inv.state not in ('cancel','draft'):
20@@ -428,9 +428,8 @@
21 _('Could not cancel this purchase order !'),
22 _('You must first cancel all invoices attached to this purchase order.'))
23 if inv:
24- wf_service = netsvc.LocalService("workflow")
25 wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr)
26- self.write(cr,uid,ids,{'state':'cancel'})
27+ wf_service.trg_validate(uid, 'purchase.order', purchase.id, 'cancel', cr)
28 for (id,name) in self.name_get(cr, uid, ids):
29 message = _("Purchase order '%s' is cancelled.") % name
30 self.log(cr, uid, id, message)