Merge lp:~openerp-dev/openobject-addons/6.0-opw-6172-ach into lp:openobject-addons/6.0

Proposed by Anup(SerpentCS)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-6172-ach
Merge into: lp:openobject-addons/6.0
Diff against target: 50 lines (+18/-0)
3 files modified
procurement/procurement.py (+12/-0)
procurement/procurement_view.xml (+1/-0)
procurement/procurement_workflow.xml (+5/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-6172-ach
Reviewer Review Type Date Requested Status
Jay Vora (Serpent Consulting Services) (community) Needs Information
Review via email: mp+65646@code.launchpad.net

Description of the change

Hello,

  There were few issues with procurement workflow.

When MRP is not installed the procurement order for a product of type "Make to Order" and "Produce" is stuck in the exception state. It is not possible to cancel a procurement order though a button exist to cancel a procurement.

Now when a procurement is in cancel state it also needs to be brought to the draft state. This will be useful when you've manually created a procurement and you need to make some modifications.

This fixes the workflow of procurement.

Kindly share your views.

Thanks.

To post a comment you must log in.
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Anup,

I afraid, we should not do such a major workflow related change in stable version.

Thanks for your perfect solution, we will surely have a discussion.

review: Needs Information

Unmerged revisions

4669. By Anup(SerpentCS)

[FIX] procurement : Procurement's workflow corrected

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'procurement/procurement.py'
2--- procurement/procurement.py 2011-03-10 09:52:41 +0000
3+++ procurement/procurement.py 2011-06-23 12:09:40 +0000
4@@ -152,6 +152,18 @@
5 }
6 return {'value': v}
7 return {}
8+
9+ def action_cancel_draft(self, cr, uid, ids, *args):
10+ self.write(cr,uid,ids,{'state':'draft'})
11+ wf_service = netsvc.LocalService("workflow")
12+ for proc_id in ids:
13+ # Deleting the existing instance of workflow for SO
14+ wf_service.trg_delete(uid, 'procurement.order', proc_id, cr)
15+ wf_service.trg_create(uid, 'procurement.order', proc_id, cr)
16+ for (id,name) in self.name_get(cr, uid, ids):
17+ message = _("The Procurement order '%s' has been set in draft state.") %(name,)
18+ self.log(cr, uid, id, message)
19+ return True
20
21 def check_product(self, cr, uid, ids):
22 """ Checks product type.
23
24=== modified file 'procurement/procurement_view.xml'
25--- procurement/procurement_view.xml 2011-01-17 13:55:22 +0000
26+++ procurement/procurement_view.xml 2011-06-23 12:09:40 +0000
27@@ -77,6 +77,7 @@
28 <button name="button_confirm" states="draft" string="Confirm" icon="gtk-apply"/>
29 <button name="button_restart" states="exception" string="Retry" icon="gtk-convert"/>
30 <button name="button_check" states="confirmed" string="Run Procurement" icon="gtk-media-play"/>
31+ <button name="action_cancel_draft" states="cancel" string="Set to Draft" icon="gtk-convert" type="object"/>
32 </group>
33 </page>
34 <page string="Extra Information">
35
36=== modified file 'procurement/procurement_workflow.xml'
37--- procurement/procurement_workflow.xml 2011-01-14 00:11:01 +0000
38+++ procurement/procurement_workflow.xml 2011-06-23 12:09:40 +0000
39@@ -163,6 +163,11 @@
40 <field name="act_to" ref="act_produce_check"/>
41 <field name="condition">check_produce()</field>
42 </record>
43+ <record id="trans_produce_check_cancel" model="workflow.transition">
44+ <field name="act_from" ref="act_produce_check"/>
45+ <field name="act_to" ref="act_cancel"/>
46+ <field name="signal">button_cancel</field>
47+ </record>
48 <record id="trans_product_check_produce_service" model="workflow.transition">
49 <field name="act_from" ref="act_produce_check"/>
50 <field name="act_to" ref="act_produce_service"/>