Merge lp:~savoirfairelinux-openerp/knowledge-addons/7.0-document_page_approval into lp:knowledge-addons/7.0
- 7.0-document_page_approval
- Merge into 7.0
Status: | Merged |
---|---|
Merged at revision: | 13 |
Proposed branch: | lp:~savoirfairelinux-openerp/knowledge-addons/7.0-document_page_approval |
Merge into: | lp:knowledge-addons/7.0 |
Diff against target: |
709 lines (+661/-0) 9 files modified
document_page_approval/__init__.py (+24/-0) document_page_approval/__openerp__.py (+57/-0) document_page_approval/document_page_approval.py (+212/-0) document_page_approval/document_page_view.xml (+51/-0) document_page_approval/document_page_wkfl.xml (+77/-0) document_page_approval/i18n/document_page_approval.pot (+110/-0) document_page_approval/i18n/fr.po (+119/-0) document_page_approval/security/document_page_security.xml (+9/-0) document_page_approval/security/ir.model.access.csv (+2/-0) |
To merge this branch: | bzr merge lp:~savoirfairelinux-openerp/knowledge-addons/7.0-document_page_approval |
Related bugs: | |
Related blueprints: |
Document page approval
(Medium)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Joao Alfredo Gama Batista | code review, no tests | Approve | |
Joël Grand-Guillaume @ camptocamp | code review, no tests | Approve | |
Maxime Chambreuil (http://www.savoirfairelinux.com) | test and review | Approve | |
Review via email: mp+175604@code.launchpad.net |
Commit message
[ADD] document_
Description of the change
To post a comment you must log in.
- 12. By Maxime Chambreuil (http://www.savoirfairelinux.com)
-
[IMP] Documentation
[ADD] Translation file + french
[FIX] employee_id field does not exist
[FIX] user_email field deprecated
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) : | # |
review:
Approve
(test and review)
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote : | # |
review:
Approve
(code review, no tests)
- 13. By Maxime Chambreuil (http://www.savoirfairelinux.com)
-
[IMP] Split long lines
Revision history for this message
Joao Alfredo Gama Batista (joao-gama) wrote : | # |
lgtm.
review:
Approve
(code review, no tests)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'document_page_approval' | |||
2 | === added file 'document_page_approval/__init__.py' | |||
3 | --- document_page_approval/__init__.py 1970-01-01 00:00:00 +0000 | |||
4 | +++ document_page_approval/__init__.py 2013-07-19 12:07:29 +0000 | |||
5 | @@ -0,0 +1,24 @@ | |||
6 | 1 | # -*- encoding: utf-8 -*- | ||
7 | 2 | ############################################################################## | ||
8 | 3 | # | ||
9 | 4 | # OpenERP, Open Source Management Solution | ||
10 | 5 | # Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). | ||
11 | 6 | # | ||
12 | 7 | # This program is free software: you can redistribute it and/or modify | ||
13 | 8 | # it under the terms of the GNU Affero General Public License as | ||
14 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
15 | 10 | # License, or (at your option) any later version. | ||
16 | 11 | # | ||
17 | 12 | # This program is distributed in the hope that it will be useful, | ||
18 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | 15 | # GNU Affero General Public License for more details. | ||
21 | 16 | # | ||
22 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
23 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
24 | 19 | # | ||
25 | 20 | ############################################################################## | ||
26 | 21 | |||
27 | 22 | import document_page_approval | ||
28 | 23 | |||
29 | 24 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
30 | 0 | 25 | ||
31 | === added file 'document_page_approval/__openerp__.py' | |||
32 | --- document_page_approval/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
33 | +++ document_page_approval/__openerp__.py 2013-07-19 12:07:29 +0000 | |||
34 | @@ -0,0 +1,57 @@ | |||
35 | 1 | # -*- encoding: utf-8 -*- | ||
36 | 2 | ############################################################################## | ||
37 | 3 | # | ||
38 | 4 | # OpenERP, Open Source Management Solution | ||
39 | 5 | # Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). | ||
40 | 6 | # | ||
41 | 7 | # This program is free software: you can redistribute it and/or modify | ||
42 | 8 | # it under the terms of the GNU Affero General Public License as | ||
43 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
44 | 10 | # License, or (at your option) any later version. | ||
45 | 11 | # | ||
46 | 12 | # This program is distributed in the hope that it will be useful, | ||
47 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
48 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
49 | 15 | # GNU Affero General Public License for more details. | ||
50 | 16 | # | ||
51 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
52 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
53 | 19 | # | ||
54 | 20 | ############################################################################## | ||
55 | 21 | |||
56 | 22 | { | ||
57 | 23 | 'name': 'Document Page Approval', | ||
58 | 24 | 'version': '1.0', | ||
59 | 25 | "author" : "Savoir-faire Linux", | ||
60 | 26 | "website" : "http://www.savoirfairelinux.com", | ||
61 | 27 | "license" : "AGPL-3", | ||
62 | 28 | 'category': 'Knowledge Management', | ||
63 | 29 | 'description': """ | ||
64 | 30 | This module adds a workflow to approve page modification and show the approved version by default. | ||
65 | 31 | |||
66 | 32 | Scenario | ||
67 | 33 | ======== | ||
68 | 34 | |||
69 | 35 | * Set a valid email address on the company settings. | ||
70 | 36 | * Create a new page category and set an approver group. Make sure users belonging to that group | ||
71 | 37 | have valid email addresses. | ||
72 | 38 | * Create a new page and choose the previously created category. | ||
73 | 39 | * A notification is sent to the group with a link to the page history to review. | ||
74 | 40 | * Depending on the review, the page history is approved or not. | ||
75 | 41 | * Users reading the page see the last approved version. | ||
76 | 42 | """, | ||
77 | 43 | 'depends': [ | ||
78 | 44 | 'document_page', | ||
79 | 45 | 'email_template', | ||
80 | 46 | ], | ||
81 | 47 | 'data': [ | ||
82 | 48 | 'document_page_wkfl.xml', | ||
83 | 49 | 'document_page_view.xml', | ||
84 | 50 | 'security/document_page_security.xml', | ||
85 | 51 | 'security/ir.model.access.csv', | ||
86 | 52 | ], | ||
87 | 53 | 'installable': True, | ||
88 | 54 | 'auto_install': False, | ||
89 | 55 | 'images': [], | ||
90 | 56 | } | ||
91 | 57 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
92 | 0 | 58 | ||
93 | === added file 'document_page_approval/document_page_approval.py' | |||
94 | --- document_page_approval/document_page_approval.py 1970-01-01 00:00:00 +0000 | |||
95 | +++ document_page_approval/document_page_approval.py 2013-07-19 12:07:29 +0000 | |||
96 | @@ -0,0 +1,212 @@ | |||
97 | 1 | # -*- encoding: utf-8 -*- | ||
98 | 2 | ############################################################################## | ||
99 | 3 | # | ||
100 | 4 | # OpenERP, Open Source Management Solution | ||
101 | 5 | # Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). | ||
102 | 6 | # | ||
103 | 7 | # This program is free software: you can redistribute it and/or modify | ||
104 | 8 | # it under the terms of the GNU Affero General Public License as | ||
105 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
106 | 10 | # License, or (at your option) any later version. | ||
107 | 11 | # | ||
108 | 12 | # This program is distributed in the hope that it will be useful, | ||
109 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
110 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
111 | 15 | # GNU Affero General Public License for more details. | ||
112 | 16 | # | ||
113 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
114 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
115 | 19 | # | ||
116 | 20 | ############################################################################## | ||
117 | 21 | from openerp.osv import fields, orm | ||
118 | 22 | from datetime import * | ||
119 | 23 | |||
120 | 24 | class document_page_history_wkfl(orm.Model): | ||
121 | 25 | _inherit = 'document.page.history' | ||
122 | 26 | |||
123 | 27 | def page_approval_draft(self, cr, uid, ids): | ||
124 | 28 | self.write(cr, uid, ids, { 'state' : 'draft' }) | ||
125 | 29 | |||
126 | 30 | template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, | ||
127 | 31 | 'document_page_approval', 'email_template_new_draft_need_approval')[1] | ||
128 | 32 | for page in self.browse(cr, uid, ids): | ||
129 | 33 | if page.is_parent_approval_required: | ||
130 | 34 | self.pool.get('email.template').send_mail(cr, uid, template_id, | ||
131 | 35 | page.id, force_send=True) | ||
132 | 36 | |||
133 | 37 | return True | ||
134 | 38 | |||
135 | 39 | def page_approval_approved(self, cr, uid, ids): | ||
136 | 40 | self.write(cr, uid, ids, { 'state' : 'approved', | ||
137 | 41 | 'approved_date' : datetime.now().strftime('%Y-%m-%d %H:%M:%S'), | ||
138 | 42 | 'approved_uid': uid | ||
139 | 43 | }) | ||
140 | 44 | return True | ||
141 | 45 | |||
142 | 46 | def can_user_approve_page(self, cr, uid, ids, name, args, context=None): | ||
143 | 47 | user = self.pool.get('res.users').browse(cr,uid,uid) | ||
144 | 48 | res = {} | ||
145 | 49 | for page in self.browse(cr, uid, ids, context=context): | ||
146 | 50 | res[page.id]= self.can_user_approve_this_page(page.page_id, user) | ||
147 | 51 | |||
148 | 52 | return res | ||
149 | 53 | |||
150 | 54 | def can_user_approve_this_page(self, page, user): | ||
151 | 55 | if page: | ||
152 | 56 | res = page.approver_gid in user.groups_id | ||
153 | 57 | res = res or self.can_user_approve_this_page(page.parent_id, user) | ||
154 | 58 | else: | ||
155 | 59 | res=False | ||
156 | 60 | |||
157 | 61 | return res | ||
158 | 62 | |||
159 | 63 | def get_approvers_guids(self, cr, uid, ids, name, args, context=None): | ||
160 | 64 | res = {} | ||
161 | 65 | for page in self.browse(cr, uid, ids, context=context): | ||
162 | 66 | res[page.id]= self.get_approvers_guids_for_page(page.page_id) | ||
163 | 67 | |||
164 | 68 | return res | ||
165 | 69 | |||
166 | 70 | def get_approvers_guids_for_page(self, page): | ||
167 | 71 | if page: | ||
168 | 72 | if page.approver_gid: | ||
169 | 73 | res = [page.approver_gid.id] | ||
170 | 74 | else: | ||
171 | 75 | res=[] | ||
172 | 76 | res.extend(self.get_approvers_guids_for_page(page.parent_id)) | ||
173 | 77 | else: | ||
174 | 78 | res=[] | ||
175 | 79 | |||
176 | 80 | return res | ||
177 | 81 | |||
178 | 82 | def get_approvers_email(self, cr, uid, ids, name, args, context): | ||
179 | 83 | res = {} | ||
180 | 84 | for id in ids: | ||
181 | 85 | emails = '' | ||
182 | 86 | guids = self.get_approvers_guids(cr, uid, ids, name, args, context=context) | ||
183 | 87 | uids = self.pool.get('res.users').search(cr, uid, [('groups_id','in',guids[id])]) | ||
184 | 88 | users = self.pool.get('res.users').browse(cr, uid, uids) | ||
185 | 89 | |||
186 | 90 | for user in users: | ||
187 | 91 | if user.email: | ||
188 | 92 | emails += user.email | ||
189 | 93 | emails += ',' | ||
190 | 94 | else: | ||
191 | 95 | empl_id = self.pool.get('hr.employee').search(cr, uid, | ||
192 | 96 | [('login','=',user.login)])[0] | ||
193 | 97 | empl = self.pool.get('hr.employee').browse(cr, uid, empl_id) | ||
194 | 98 | if empl.work_email: | ||
195 | 99 | emails += empl.work_email | ||
196 | 100 | emails += ',' | ||
197 | 101 | |||
198 | 102 | emails = emails[:-1] | ||
199 | 103 | res[id] = emails | ||
200 | 104 | return res | ||
201 | 105 | |||
202 | 106 | def get_page_url(self, cr, uid, ids, name, args, context): | ||
203 | 107 | res = {} | ||
204 | 108 | for id in ids: | ||
205 | 109 | base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, | ||
206 | 110 | 'web.base.url', default='http://localhost:8069', context=context) | ||
207 | 111 | |||
208 | 112 | res[id] = base_url + '/#db=%s&id=%s&view_type=form&model=document.page.history' % (cr.dbname, id); | ||
209 | 113 | |||
210 | 114 | return res | ||
211 | 115 | |||
212 | 116 | _columns = { | ||
213 | 117 | 'state': fields.selection([ | ||
214 | 118 | ('draft','Draft'), | ||
215 | 119 | ('approved','Approved')], 'Status', readonly=True), | ||
216 | 120 | 'approved_date': fields.datetime("Approved Date"), | ||
217 | 121 | 'approved_uid': fields.many2one('res.users', "Approved By"), | ||
218 | 122 | 'is_parent_approval_required': fields.related('page_id', 'is_parent_approval_required', | ||
219 | 123 | string="parent approval", type='boolean', store=False), | ||
220 | 124 | 'can_user_approve_page': fields.function(can_user_approve_page, | ||
221 | 125 | string="can user approve this page", type='boolean', store=False), | ||
222 | 126 | 'get_approvers_email': fields.function(get_approvers_email, | ||
223 | 127 | string="get all approvers email", type='text', store=False), | ||
224 | 128 | 'get_page_url': fields.function(get_page_url, string="URL", type='text', | ||
225 | 129 | store=False), | ||
226 | 130 | } | ||
227 | 131 | |||
228 | 132 | class document_page_approval(orm.Model): | ||
229 | 133 | _inherit = 'document.page' | ||
230 | 134 | def _get_display_content(self, cr, uid, ids, name, args, context=None): | ||
231 | 135 | res = {} | ||
232 | 136 | for page in self.browse(cr, uid, ids, context=context): | ||
233 | 137 | content="" | ||
234 | 138 | if page.type == "category": | ||
235 | 139 | content = self._get_page_index(cr, uid, page, link=False) | ||
236 | 140 | else: | ||
237 | 141 | history = self.pool.get('document.page.history') | ||
238 | 142 | if self.is_approval_required(page): | ||
239 | 143 | history_ids = history.search(cr, uid,[('page_id', '=', page.id), | ||
240 | 144 | ('state', '=', 'approved')], limit=1, order='create_date DESC') | ||
241 | 145 | for h in history.browse(cr, uid, history_ids): | ||
242 | 146 | content = h.content | ||
243 | 147 | else: | ||
244 | 148 | content = page.content | ||
245 | 149 | res[page.id] = content | ||
246 | 150 | return res | ||
247 | 151 | |||
248 | 152 | def _get_approved_date(self, cr, uid, ids, name, args, context=None): | ||
249 | 153 | res = {} | ||
250 | 154 | for page in self.browse(cr, uid, ids, context=context): | ||
251 | 155 | if self.is_approval_required(page): | ||
252 | 156 | history = self.pool.get('document.page.history') | ||
253 | 157 | history_ids = history.search(cr, uid,[('page_id', '=', page.id), | ||
254 | 158 | ('state', '=', 'approved')], limit=1, order='create_date DESC') | ||
255 | 159 | approved_date = False | ||
256 | 160 | for h in history.browse(cr, uid, history_ids): | ||
257 | 161 | approved_date = h.approved_date | ||
258 | 162 | res[page.id] = approved_date | ||
259 | 163 | else: | ||
260 | 164 | res[page.id] = "" | ||
261 | 165 | |||
262 | 166 | return res | ||
263 | 167 | |||
264 | 168 | def _get_approved_uid(self, cr, uid, ids, name, args, context=None): | ||
265 | 169 | res = {} | ||
266 | 170 | for page in self.browse(cr, uid, ids, context=context): | ||
267 | 171 | if self.is_approval_required(page): | ||
268 | 172 | history = self.pool.get('document.page.history') | ||
269 | 173 | history_ids = history.search(cr, uid,[('page_id', '=', page.id), | ||
270 | 174 | ('state', '=', 'approved')], limit=1, order='create_date DESC') | ||
271 | 175 | approved_uid = False | ||
272 | 176 | for h in history.browse(cr, uid, history_ids): | ||
273 | 177 | approved_uid = h.approved_uid.id | ||
274 | 178 | res[page.id] = approved_uid | ||
275 | 179 | else: | ||
276 | 180 | res[page.id] = "" | ||
277 | 181 | |||
278 | 182 | return res | ||
279 | 183 | |||
280 | 184 | def _is_parent_approval_required(self, cr, uid, ids, name, args, context=None): | ||
281 | 185 | res = {} | ||
282 | 186 | for page in self.browse(cr, uid, ids, context=context): | ||
283 | 187 | res[page.id]= self.is_approval_required(page) | ||
284 | 188 | |||
285 | 189 | return res | ||
286 | 190 | |||
287 | 191 | def is_approval_required(self, page): | ||
288 | 192 | if page: | ||
289 | 193 | res = page.approval_required | ||
290 | 194 | res = res or self.is_approval_required(page.parent_id) | ||
291 | 195 | else: | ||
292 | 196 | res=False | ||
293 | 197 | |||
294 | 198 | return res | ||
295 | 199 | |||
296 | 200 | _columns = { | ||
297 | 201 | 'display_content': fields.function(_get_display_content, | ||
298 | 202 | string='Displayed Content', type='text'), | ||
299 | 203 | 'approved_date': fields.function(_get_approved_date, string="Approved Date", | ||
300 | 204 | type='datetime'), | ||
301 | 205 | 'approved_uid': fields.function(_get_approved_uid, string="Approved By", | ||
302 | 206 | type='many2one', obj='res.users'), | ||
303 | 207 | 'approval_required': fields.boolean("Require approval"), | ||
304 | 208 | 'is_parent_approval_required': fields.function(_is_parent_approval_required, | ||
305 | 209 | string="parent approval", type='boolean'), | ||
306 | 210 | 'approver_gid': fields.many2one("res.groups", "Approver group"), | ||
307 | 211 | } | ||
308 | 212 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
309 | 0 | 213 | ||
310 | === added file 'document_page_approval/document_page_view.xml' | |||
311 | --- document_page_approval/document_page_view.xml 1970-01-01 00:00:00 +0000 | |||
312 | +++ document_page_approval/document_page_view.xml 2013-07-19 12:07:29 +0000 | |||
313 | @@ -0,0 +1,51 @@ | |||
314 | 1 | <?xml version="1.0"?> | ||
315 | 2 | <openerp> | ||
316 | 3 | <data> | ||
317 | 4 | <record id="wiki_history_form_inherit" model="ir.ui.view"> | ||
318 | 5 | <field name="name">document.page.history.form</field> | ||
319 | 6 | <field name="model">document.page.history</field> | ||
320 | 7 | <field name="inherit_id" ref="document_page.wiki_history_form"/> | ||
321 | 8 | <field name="arch" type="xml"> | ||
322 | 9 | <xpath expr="//form/label[@for='page_id']" position="before"> | ||
323 | 10 | <header attrs="{'invisible':[('is_parent_approval_required','=',False)]}"> | ||
324 | 11 | <span attrs="{'invisible':[('can_user_approve_page','=',False)]}"> | ||
325 | 12 | <button name="page_approval_approve" string="Approve" states="draft"/> | ||
326 | 13 | </span> | ||
327 | 14 | <field name="state" widget="statusbar" statusbar_visible="draft,approved"/> | ||
328 | 15 | <field name="is_parent_approval_required" invisible="1"/> | ||
329 | 16 | <field name="can_user_approve_page" invisible="1"/> | ||
330 | 17 | </header> | ||
331 | 18 | </xpath> | ||
332 | 19 | </field> | ||
333 | 20 | </record> | ||
334 | 21 | |||
335 | 22 | <record id="wiki_form_inherit" model="ir.ui.view"> | ||
336 | 23 | <field name="name">document.page.form</field> | ||
337 | 24 | <field name="model">document.page</field> | ||
338 | 25 | <field name="inherit_id" ref="document_page.view_wiki_form"/> | ||
339 | 26 | <field name="arch" type="xml"> | ||
340 | 27 | <field name="display_content" position="before"> | ||
341 | 28 | <field name="approved_date" class="oe_view_only"/> | ||
342 | 29 | <field name="approved_uid" class="oe_view_only"/> | ||
343 | 30 | </field> | ||
344 | 31 | <field name="parent_id" position="after"> | ||
345 | 32 | <field name="approval_required" attrs="{'invisible':[('type','=','content')]}"/> | ||
346 | 33 | <field name="approver_gid" attrs="{'invisible':['|',('type','=','content'), | ||
347 | 34 | ('approval_required','!=', True)], 'required':[('approval_required','=', True)]}"/> | ||
348 | 35 | </field> | ||
349 | 36 | </field> | ||
350 | 37 | </record> | ||
351 | 38 | |||
352 | 39 | <record id="view_wiki_history_tree_inherit" model="ir.ui.view"> | ||
353 | 40 | <field name="name">document.page.history.tree</field> | ||
354 | 41 | <field name="model">document.page.history</field> | ||
355 | 42 | <field name="inherit_id" ref="document_page.view_wiki_history_tree"/> | ||
356 | 43 | <field name="arch" type="xml"> | ||
357 | 44 | <field name="page_id" position="after"> | ||
358 | 45 | <field name="state" attrs="{'invisible':[('is_parent_approval_required','=',False)]}"/> | ||
359 | 46 | <field name="is_parent_approval_required" invisible="1"/> | ||
360 | 47 | </field> | ||
361 | 48 | </field> | ||
362 | 49 | </record> | ||
363 | 50 | </data> | ||
364 | 51 | </openerp> | ||
365 | 0 | 52 | ||
366 | === added file 'document_page_approval/document_page_wkfl.xml' | |||
367 | --- document_page_approval/document_page_wkfl.xml 1970-01-01 00:00:00 +0000 | |||
368 | +++ document_page_approval/document_page_wkfl.xml 2013-07-19 12:07:29 +0000 | |||
369 | @@ -0,0 +1,77 @@ | |||
370 | 1 | <?xml version="1.0"?> | ||
371 | 2 | <openerp> | ||
372 | 3 | <data> | ||
373 | 4 | |||
374 | 5 | <record model="workflow" id="wkf_document_page_history_aproval"> | ||
375 | 6 | <field name="name">document.page.history.aproval.wkf</field> | ||
376 | 7 | <field name="osv">document.page.history</field> | ||
377 | 8 | <field name="on_create">True</field> | ||
378 | 9 | </record> | ||
379 | 10 | |||
380 | 11 | <record model="workflow.activity" id="act_draft"> | ||
381 | 12 | <field name="wkf_id" ref="wkf_document_page_history_aproval" /> | ||
382 | 13 | <field name="flow_start">True</field> | ||
383 | 14 | <field name="name">draft</field> | ||
384 | 15 | <field name="kind">function</field> | ||
385 | 16 | <field name="action">page_approval_draft()</field> | ||
386 | 17 | </record> | ||
387 | 18 | |||
388 | 19 | <record model="workflow.activity" id="act_approved"> | ||
389 | 20 | <field name="wkf_id" ref="wkf_document_page_history_aproval" /> | ||
390 | 21 | <field name="name">approved</field> | ||
391 | 22 | <field name="kind">function</field> | ||
392 | 23 | <field name="action">page_approval_approved()</field> | ||
393 | 24 | <field name="flow_stop">True</field> | ||
394 | 25 | </record> | ||
395 | 26 | |||
396 | 27 | <record model="workflow.transition" id="tda"> | ||
397 | 28 | <field name="act_from" ref="act_draft" /> | ||
398 | 29 | <field name="act_to" ref="act_approved" /> | ||
399 | 30 | <field name="signal">page_approval_approve</field> | ||
400 | 31 | </record> | ||
401 | 32 | |||
402 | 33 | <record model="workflow.transition" id="tad"> | ||
403 | 34 | <field name="act_from" ref="act_approved" /> | ||
404 | 35 | <field name="act_to" ref="act_draft" /> | ||
405 | 36 | <field name="signal">edit</field> | ||
406 | 37 | </record> | ||
407 | 38 | |||
408 | 39 | </data> | ||
409 | 40 | |||
410 | 41 | <!-- Allow user to make upgrade-proof customizations to email template --> | ||
411 | 42 | |||
412 | 43 | <data noupdate="1"> | ||
413 | 44 | |||
414 | 45 | <record id="email_template_new_draft_need_approval" model="email.template"> | ||
415 | 46 | <field name="name">Automated new draft need approval Notification Mail</field> | ||
416 | 47 | <field name="email_from">${object.create_uid.company_id.email or 'noreply@localhost.com'}</field> | ||
417 | 48 | <field name="subject">New version of "${object.page_id.name}" to approve</field> | ||
418 | 49 | <field name="email_to">${object.get_approvers_email}</field> | ||
419 | 50 | <field name="model_id" ref="model_document_page_history"/> | ||
420 | 51 | <field name="auto_delete" eval="True"/> | ||
421 | 52 | <field name="lang">${object.create_uid.partner_id.lang}</field> | ||
422 | 53 | <field name="body_html"><![CDATA[ | ||
423 | 54 | <p>Hello,</p> | ||
424 | 55 | |||
425 | 56 | <p>The page "${object.page_id.name}" has been modified and need your approval.</p> | ||
426 | 57 | |||
427 | 58 | <p>You can review the new version here : <a href="${object.get_page_url}">${object.get_page_url}</a></p> | ||
428 | 59 | |||
429 | 60 | <p>Have a great day.<br/> | ||
430 | 61 | --<br/> | ||
431 | 62 | OpenERP</p>]]> | ||
432 | 63 | </field> | ||
433 | 64 | <field name="body_text"><![CDATA[ | ||
434 | 65 | Hello, | ||
435 | 66 | |||
436 | 67 | The page "${object.page_id.name}" has been modified and need your approval. | ||
437 | 68 | |||
438 | 69 | You can review the new version here: ${object.get_page_url} | ||
439 | 70 | |||
440 | 71 | Have a great day. | ||
441 | 72 | -- | ||
442 | 73 | OpenERP]]></field> | ||
443 | 74 | </record> | ||
444 | 75 | |||
445 | 76 | </data> | ||
446 | 77 | </openerp> | ||
447 | 0 | 78 | ||
448 | === added directory 'document_page_approval/i18n' | |||
449 | === added file 'document_page_approval/i18n/document_page_approval.pot' | |||
450 | --- document_page_approval/i18n/document_page_approval.pot 1970-01-01 00:00:00 +0000 | |||
451 | +++ document_page_approval/i18n/document_page_approval.pot 2013-07-19 12:07:29 +0000 | |||
452 | @@ -0,0 +1,110 @@ | |||
453 | 1 | # Translation of OpenERP Server. | ||
454 | 2 | # This file contains the translation of the following modules: | ||
455 | 3 | # * document_page_approval | ||
456 | 4 | # | ||
457 | 5 | msgid "" | ||
458 | 6 | msgstr "" | ||
459 | 7 | "Project-Id-Version: OpenERP Server 7.0\n" | ||
460 | 8 | "Report-Msgid-Bugs-To: \n" | ||
461 | 9 | "POT-Creation-Date: 2013-07-19 03:58+0000\n" | ||
462 | 10 | "PO-Revision-Date: 2013-07-19 03:58+0000\n" | ||
463 | 11 | "Last-Translator: <>\n" | ||
464 | 12 | "Language-Team: \n" | ||
465 | 13 | "MIME-Version: 1.0\n" | ||
466 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
467 | 15 | "Content-Transfer-Encoding: \n" | ||
468 | 16 | "Plural-Forms: \n" | ||
469 | 17 | |||
470 | 18 | #. module: document_page_approval | ||
471 | 19 | #: field:document.page.history,state:0 | ||
472 | 20 | msgid "Status" | ||
473 | 21 | msgstr "" | ||
474 | 22 | |||
475 | 23 | #. module: document_page_approval | ||
476 | 24 | #: field:document.page,approval_required:0 | ||
477 | 25 | msgid "Require approval" | ||
478 | 26 | msgstr "" | ||
479 | 27 | |||
480 | 28 | #. module: document_page_approval | ||
481 | 29 | #: field:document.page,is_parent_approval_required:0 | ||
482 | 30 | #: field:document.page.history,is_parent_approval_required:0 | ||
483 | 31 | msgid "parent approval" | ||
484 | 32 | msgstr "" | ||
485 | 33 | |||
486 | 34 | #. module: document_page_approval | ||
487 | 35 | #: model:email.template,body_html:document_page_approval.email_template_new_draft_need_approval | ||
488 | 36 | msgid "\n" | ||
489 | 37 | "<p>Hello,</p>\n" | ||
490 | 38 | "\n" | ||
491 | 39 | "<p>The page \"${object.page_id.name}\" has been modified and need your approval.</p>\n" | ||
492 | 40 | "\n" | ||
493 | 41 | "<p>You can review the new version here : <a href=\"${object.get_page_url}\">${object.get_page_url}</a></p>\n" | ||
494 | 42 | " \n" | ||
495 | 43 | "<p>Have a great day.<br/>\n" | ||
496 | 44 | "--<br/>\n" | ||
497 | 45 | "OpenERP</p>\n" | ||
498 | 46 | " " | ||
499 | 47 | msgstr "" | ||
500 | 48 | |||
501 | 49 | #. module: document_page_approval | ||
502 | 50 | #: model:ir.model,name:document_page_approval.model_document_page | ||
503 | 51 | msgid "Document Page" | ||
504 | 52 | msgstr "" | ||
505 | 53 | |||
506 | 54 | #. module: document_page_approval | ||
507 | 55 | #: field:document.page,approved_uid:0 | ||
508 | 56 | #: field:document.page.history,approved_uid:0 | ||
509 | 57 | msgid "Approved By" | ||
510 | 58 | msgstr "" | ||
511 | 59 | |||
512 | 60 | #. module: document_page_approval | ||
513 | 61 | #: model:email.template,subject:document_page_approval.email_template_new_draft_need_approval | ||
514 | 62 | msgid "New version of \"${object.page_id.name}\" to approve" | ||
515 | 63 | msgstr "" | ||
516 | 64 | |||
517 | 65 | #. module: document_page_approval | ||
518 | 66 | #: selection:document.page.history,state:0 | ||
519 | 67 | msgid "Draft" | ||
520 | 68 | msgstr "" | ||
521 | 69 | |||
522 | 70 | #. module: document_page_approval | ||
523 | 71 | #: field:document.page.history,get_page_url:0 | ||
524 | 72 | msgid "URL" | ||
525 | 73 | msgstr "" | ||
526 | 74 | |||
527 | 75 | #. module: document_page_approval | ||
528 | 76 | #: field:document.page,approved_date:0 | ||
529 | 77 | #: field:document.page.history,approved_date:0 | ||
530 | 78 | msgid "Approved Date" | ||
531 | 79 | msgstr "" | ||
532 | 80 | |||
533 | 81 | #. module: document_page_approval | ||
534 | 82 | #: field:document.page.history,can_user_approve_page:0 | ||
535 | 83 | msgid "can user approve this page" | ||
536 | 84 | msgstr "" | ||
537 | 85 | |||
538 | 86 | #. module: document_page_approval | ||
539 | 87 | #: field:document.page,approver_gid:0 | ||
540 | 88 | msgid "Approver group" | ||
541 | 89 | msgstr "" | ||
542 | 90 | |||
543 | 91 | #. module: document_page_approval | ||
544 | 92 | #: model:ir.model,name:document_page_approval.model_document_page_history | ||
545 | 93 | msgid "Document Page History" | ||
546 | 94 | msgstr "" | ||
547 | 95 | |||
548 | 96 | #. module: document_page_approval | ||
549 | 97 | #: view:document.page.history:0 | ||
550 | 98 | msgid "Approve" | ||
551 | 99 | msgstr "" | ||
552 | 100 | |||
553 | 101 | #. module: document_page_approval | ||
554 | 102 | #: selection:document.page.history,state:0 | ||
555 | 103 | msgid "Approved" | ||
556 | 104 | msgstr "" | ||
557 | 105 | |||
558 | 106 | #. module: document_page_approval | ||
559 | 107 | #: field:document.page.history,get_approvers_email:0 | ||
560 | 108 | msgid "get all approvers email" | ||
561 | 109 | msgstr "" | ||
562 | 110 | |||
563 | 0 | 111 | ||
564 | === added file 'document_page_approval/i18n/fr.po' | |||
565 | --- document_page_approval/i18n/fr.po 1970-01-01 00:00:00 +0000 | |||
566 | +++ document_page_approval/i18n/fr.po 2013-07-19 12:07:29 +0000 | |||
567 | @@ -0,0 +1,119 @@ | |||
568 | 1 | # Translation of OpenERP Server. | ||
569 | 2 | # This file contains the translation of the following modules: | ||
570 | 3 | # * document_page_approval | ||
571 | 4 | # | ||
572 | 5 | msgid "" | ||
573 | 6 | msgstr "" | ||
574 | 7 | "Project-Id-Version: OpenERP Server 7.0\n" | ||
575 | 8 | "Report-Msgid-Bugs-To: \n" | ||
576 | 9 | "POT-Creation-Date: 2013-07-19 03:58+0000\n" | ||
577 | 10 | "PO-Revision-Date: 2013-07-19 03:58+0000\n" | ||
578 | 11 | "Last-Translator: <>\n" | ||
579 | 12 | "Language-Team: \n" | ||
580 | 13 | "MIME-Version: 1.0\n" | ||
581 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
582 | 15 | "Content-Transfer-Encoding: \n" | ||
583 | 16 | "Plural-Forms: \n" | ||
584 | 17 | |||
585 | 18 | #. module: document_page_approval | ||
586 | 19 | #: field:document.page.history,state:0 | ||
587 | 20 | msgid "Status" | ||
588 | 21 | msgstr "Statut" | ||
589 | 22 | |||
590 | 23 | #. module: document_page_approval | ||
591 | 24 | #: field:document.page,approval_required:0 | ||
592 | 25 | msgid "Require approval" | ||
593 | 26 | msgstr "Nécessite une approbation" | ||
594 | 27 | |||
595 | 28 | #. module: document_page_approval | ||
596 | 29 | #: field:document.page,is_parent_approval_required:0 | ||
597 | 30 | #: field:document.page.history,is_parent_approval_required:0 | ||
598 | 31 | msgid "parent approval" | ||
599 | 32 | msgstr "Approbation parente" | ||
600 | 33 | |||
601 | 34 | #. module: document_page_approval | ||
602 | 35 | #: model:email.template,body_html:document_page_approval.email_template_new_draft_need_approval | ||
603 | 36 | msgid "\n" | ||
604 | 37 | "<p>Hello,</p>\n" | ||
605 | 38 | "\n" | ||
606 | 39 | "<p>The page \"${object.page_id.name}\" has been modified and need your approval.</p>\n" | ||
607 | 40 | "\n" | ||
608 | 41 | "<p>You can review the new version here : <a href=\"${object.get_page_url}\">${object.get_page_url}</a></p>\n" | ||
609 | 42 | " \n" | ||
610 | 43 | "<p>Have a great day.<br/>\n" | ||
611 | 44 | "--<br/>\n" | ||
612 | 45 | "OpenERP</p>\n" | ||
613 | 46 | " " | ||
614 | 47 | msgstr "\n" | ||
615 | 48 | "<p>Bonjour,</p>\n" | ||
616 | 49 | "\n" | ||
617 | 50 | "<p>La page \"${object.page_id.name}\" a été modifié et demande votre approbation.</p>\n" | ||
618 | 51 | "\n" | ||
619 | 52 | "<p>Vous pouvez réviser la nouvelle version ici : <a href=\"${object.get_page_url}\">${object.get_page_url}</a></p>\n" | ||
620 | 53 | " \n" | ||
621 | 54 | "<p>Bonne journée.<br/>\n" | ||
622 | 55 | "--<br/>\n" | ||
623 | 56 | "OpenERP</p>\n" | ||
624 | 57 | " " | ||
625 | 58 | |||
626 | 59 | #. module: document_page_approval | ||
627 | 60 | #: model:ir.model,name:document_page_approval.model_document_page | ||
628 | 61 | msgid "Document Page" | ||
629 | 62 | msgstr "Page" | ||
630 | 63 | |||
631 | 64 | #. module: document_page_approval | ||
632 | 65 | #: field:document.page,approved_uid:0 | ||
633 | 66 | #: field:document.page.history,approved_uid:0 | ||
634 | 67 | msgid "Approved By" | ||
635 | 68 | msgstr "Approuvée par" | ||
636 | 69 | |||
637 | 70 | #. module: document_page_approval | ||
638 | 71 | #: model:email.template,subject:document_page_approval.email_template_new_draft_need_approval | ||
639 | 72 | msgid "New version of \"${object.page_id.name}\" to approve" | ||
640 | 73 | msgstr "Nouvelle version de \"${object.page_id.name}\" à approuver" | ||
641 | 74 | |||
642 | 75 | #. module: document_page_approval | ||
643 | 76 | #: selection:document.page.history,state:0 | ||
644 | 77 | msgid "Draft" | ||
645 | 78 | msgstr "Brouillon" | ||
646 | 79 | |||
647 | 80 | #. module: document_page_approval | ||
648 | 81 | #: field:document.page.history,get_page_url:0 | ||
649 | 82 | msgid "URL" | ||
650 | 83 | msgstr "URL" | ||
651 | 84 | |||
652 | 85 | #. module: document_page_approval | ||
653 | 86 | #: field:document.page,approved_date:0 | ||
654 | 87 | #: field:document.page.history,approved_date:0 | ||
655 | 88 | msgid "Approved Date" | ||
656 | 89 | msgstr "Date d'approbation" | ||
657 | 90 | |||
658 | 91 | #. module: document_page_approval | ||
659 | 92 | #: field:document.page.history,can_user_approve_page:0 | ||
660 | 93 | msgid "can user approve this page" | ||
661 | 94 | msgstr "Est-ce que l'usager peut approuver cette page ?" | ||
662 | 95 | |||
663 | 96 | #. module: document_page_approval | ||
664 | 97 | #: field:document.page,approver_gid:0 | ||
665 | 98 | msgid "Approver group" | ||
666 | 99 | msgstr "Groupe approbateur" | ||
667 | 100 | |||
668 | 101 | #. module: document_page_approval | ||
669 | 102 | #: model:ir.model,name:document_page_approval.model_document_page_history | ||
670 | 103 | msgid "Document Page History" | ||
671 | 104 | msgstr "Historique de la page" | ||
672 | 105 | |||
673 | 106 | #. module: document_page_approval | ||
674 | 107 | #: view:document.page.history:0 | ||
675 | 108 | msgid "Approve" | ||
676 | 109 | msgstr "Approuver" | ||
677 | 110 | |||
678 | 111 | #. module: document_page_approval | ||
679 | 112 | #: selection:document.page.history,state:0 | ||
680 | 113 | msgid "Approved" | ||
681 | 114 | msgstr "Approuvée" | ||
682 | 115 | |||
683 | 116 | #. module: document_page_approval | ||
684 | 117 | #: field:document.page.history,get_approvers_email:0 | ||
685 | 118 | msgid "get all approvers email" | ||
686 | 119 | msgstr "Récupérer toutes les adresses courriels des approbateurs" | ||
687 | 0 | 120 | ||
688 | === added directory 'document_page_approval/security' | |||
689 | === added file 'document_page_approval/security/document_page_security.xml' | |||
690 | --- document_page_approval/security/document_page_security.xml 1970-01-01 00:00:00 +0000 | |||
691 | +++ document_page_approval/security/document_page_security.xml 2013-07-19 12:07:29 +0000 | |||
692 | @@ -0,0 +1,9 @@ | |||
693 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
694 | 2 | <openerp> | ||
695 | 3 | <data noupdate="0"> | ||
696 | 4 | <record id="base.group_document_approver_user" model="res.groups"> | ||
697 | 5 | <field name="name">Document approver</field> | ||
698 | 6 | <field name="users" eval="[(4, ref('base.user_root'))]"/> | ||
699 | 7 | </record> | ||
700 | 8 | </data> | ||
701 | 9 | </openerp> | ||
702 | 0 | 10 | ||
703 | === added file 'document_page_approval/security/ir.model.access.csv' | |||
704 | --- document_page_approval/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 | |||
705 | +++ document_page_approval/security/ir.model.access.csv 2013-07-19 12:07:29 +0000 | |||
706 | @@ -0,0 +1,2 @@ | |||
707 | 1 | id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
708 | 2 | document_page_history,document.page.history,model_document_page_history,base.group_document_approver_user,1,1,1,0 | ||
709 | 0 | \ No newline at end of file | 3 | \ No newline at end of file |
Thanks, it LGTM.
Coding: some lines may be a bit too long, would be good to split them while merging.