Merge lp:~therp-nl/openobject-addons/lp1190022 into lp:openobject-addons

Proposed by Holger Brunn (Therp)
Status: Rejected
Rejected by: Olivier Dony (Odoo)
Proposed branch: lp:~therp-nl/openobject-addons/lp1190022
Merge into: lp:openobject-addons
Diff against target: 60 lines (+20/-4)
2 files modified
hr_timesheet_sheet/hr_timesheet_sheet.py (+16/-0)
hr_timesheet_sheet/hr_timesheet_workflow.xml (+4/-4)
To merge this branch: bzr merge lp:~therp-nl/openobject-addons/lp1190022
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) Disapprove
Review via email: mp+168892@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

As I mentioned on the bug report: In trunk all workflow signals are now routed through Model.signal_xxx() methods that you can override as you want, so I think we can consider this wishlist implemented without needing any extra code in hr_timesheet_sheet itself:
   https://doc.openerp.com/trunk/server/orm-methods/#orm-workflows

Moving the code of the workflow activities into Python methods would also reduce the flexibility of the workflows (the fact that they can be customized to some extent without needing to write a module), so it's better to keep the best of both world, I think.

Thanks!

review: Disapprove

Unmerged revisions

8758. By Holger Brunn (Therp)

[IMP] call methods in workflow to write state

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_timesheet_sheet/hr_timesheet_sheet.py'
2--- hr_timesheet_sheet/hr_timesheet_sheet.py 2013-05-21 12:23:59 +0000
3+++ hr_timesheet_sheet/hr_timesheet_sheet.py 2013-06-12 09:57:37 +0000
4@@ -193,6 +193,22 @@
5 self.create_workflow(cr, uid, ids)
6 return True
7
8+ def workflow_new(self, cr, uid, ids, context=None):
9+ self.write(cr, uid, ids, {'state': 'new'}, context=context)
10+ return True
11+
12+ def workflow_draft(self, cr, uid, ids, context=None):
13+ self.write(cr, uid, ids, {'state': 'draft'}, context=context)
14+ return True
15+
16+ def workflow_confirm(self, cr, uid, ids, context=None):
17+ self.write(cr, uid, ids, {'state': 'confirm'}, context=context)
18+ return True
19+
20+ def workflow_done(self, cr, uid, ids, context=None):
21+ self.write(cr, uid, ids, {'state': 'done'}, context=context)
22+ return True
23+
24 def name_get(self, cr, uid, ids, context=None):
25 if not ids:
26 return []
27
28=== modified file 'hr_timesheet_sheet/hr_timesheet_workflow.xml'
29--- hr_timesheet_sheet/hr_timesheet_workflow.xml 2011-07-11 11:23:29 +0000
30+++ hr_timesheet_sheet/hr_timesheet_workflow.xml 2013-06-12 09:57:37 +0000
31@@ -14,26 +14,26 @@
32 <field name="wkf_id" ref="wkf_timesheet"/>
33 <field name="name">new</field>
34 <field name="kind">function</field>
35- <field name="action">write({'state':'new'})</field>
36+ <field name="action">workflow_new()</field>
37 <field name="flow_start">True</field>
38 </record>
39 <record id="act_draft" model="workflow.activity">
40 <field name="wkf_id" ref="wkf_timesheet"/>
41 <field name="name">draft</field>
42 <field name="kind">function</field>
43- <field name="action">write({'state':'draft'})</field>
44+ <field name="action">workflow_draft()</field>
45 </record>
46 <record id="act_confirm" model="workflow.activity">
47 <field name="wkf_id" ref="wkf_timesheet"/>
48 <field name="name">confirm</field>
49 <field name="kind">function</field>
50- <field name="action">write({'state':'confirm'})</field>
51+ <field name="action">workflow_confirm()</field>
52 </record>
53 <record id="act_done" model="workflow.activity">
54 <field name="wkf_id" ref="wkf_timesheet"/>
55 <field name="name">done</field>
56 <field name="kind">function</field>
57- <field name="action">write({'state':'done'})</field>
58+ <field name="action">workflow_done()</field>
59 <field name="flow_stop">True</field>
60 </record>
61

Subscribers

People subscribed via source and target branches

to all changes: