Skip to content

Commit f24799e

Browse files
ivantodorovichvictoralmau
authored andcommitted
[IMP][10.0][document_page_approval] Change Requests and workflow improvements on documents (OCA#155)
1 parent 33a0b04 commit f24799e

85 files changed

Lines changed: 17116 additions & 686 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

document_page_approval/README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Contributors
5858
* Savoir-faire Linux <support@savoirfairelinux.com>
5959
* Gervais Naoussi <gervaisnaoussi@gmail.com>
6060
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
61+
* Iván Todorovich <ivan.todorovich@gmail.com>
6162

6263
Maintainer
6364
----------

document_page_approval/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
44

55
from . import models
6+
from .hooks import post_init_hook, uninstall_hook

document_page_approval/__manifest__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{
66
'name': 'Document Page Approval',
7-
'version': '10.0.1.1.0',
7+
'version': '10.0.2.0.0',
88
"author": "Savoir-faire Linux, Odoo Community Association (OCA)",
99
"website": "http://www.savoirfairelinux.com",
1010
"license": "AGPL-3",
@@ -25,4 +25,6 @@
2525
'images/page_history_list.png',
2626
'images/page_history.png',
2727
],
28+
'post_init_hook': 'post_init_hook',
29+
'uninstall_hook': 'uninstall_hook',
2830
}

document_page_approval/data/email_template.xml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,42 @@
11
<?xml version="1.0"?>
2-
<odoo noupdate="1">
2+
<odoo>
33

4-
<!-- Allow user to make upgrade-proof customizations to email template -->
4+
<!-- If user wants to make upgrade-proof customizations to email templates, he should edit ir.model.data and check noupdate himself -->
55
<record id="email_template_new_draft_need_approval" model="mail.template">
66
<field name="name">Automated new draft need approval Notification Mail</field>
77
<field name="email_from">${object.create_uid.company_id.email or 'noreply@localhost.com'}</field>
8-
<field name="subject">New version of "${object.page_id.name}" to approve</field>
9-
<field name="email_to">${object.get_approvers_email}</field>
8+
<field name="subject">New version of ${object.display_name} needs your approval</field>
109
<field name="model_id" ref="model_document_page_history"/>
1110
<field name="auto_delete" eval="True"/>
1211
<field name="lang">${object.create_uid.partner_id.lang}</field>
1312
<field name="body_html">
1413
<![CDATA[
1514
<p>Hello,</p>
1615
17-
<p>The page "${object.page_id.name}" has been modified and need your approval.</p>
16+
<p>${object.create_uid.name} submited a new Change Request for <b>${object.page_id.name}</b> and it needs your approval.</p>
1817
19-
<p>You can review the new version here : <a href="${object.get_page_url}">${object.get_page_url}</a></p>
18+
<h1><a href="${object.page_url}">${object.display_name}</a></h1>
19+
<p>
20+
<b>Modified by:</b> ${object.create_uid.name}<br/>
21+
<b>Date:</b> ${object.create_date}<br>
22+
</p>
23+
24+
% if object.summary:
25+
<h3>Summary</h3>
26+
<p>${object.summary}</p>
27+
% endif
28+
29+
<h3>Diff</h3>
30+
<div style="overflow-x:scroll; font-size:0.85em; margin-bottom:2em;">
31+
${object.diff|safe}
32+
</div>
33+
34+
<p>Have a great day.</p>
2035
21-
<p>Have a great day.<br/>
2236
--<br/>
23-
Odoo</p>]]>
37+
38+
<p>Odoo</p>
39+
]]>
2440
</field>
2541
</record>
2642

document_page_approval/hooks.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2018 Ivan Todorovich (<ivan.todorovich@gmail.com>)
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4+
5+
6+
def post_init_hook(cr, registry): # pragma: no cover
7+
# Set all pre-existing pages history to approved
8+
cr.execute("""
9+
UPDATE document_page_history
10+
SET state='approved',
11+
approved_uid=create_uid,
12+
approved_date=create_date
13+
WHERE state IS NULL
14+
""")
15+
16+
17+
def uninstall_hook(cr, registry): # pragma: no cover
18+
# Remove unapproved pages
19+
cr.execute(
20+
"DELETE FROM document_page_history "
21+
"WHERE state != 'approved'"
22+
)

document_page_approval/i18n/am.po

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * document_page_approval
4+
#
5+
# Translators:
6+
# OCA Transbot <transbot@odoo-community.org>, 2018
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: Odoo Server 10.0\n"
10+
"Report-Msgid-Bugs-To: \n"
11+
"POT-Creation-Date: 2018-04-24 22:33+0000\n"
12+
"PO-Revision-Date: 2018-04-24 22:33+0000\n"
13+
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
14+
"Language-Team: Amharic (https://www.transifex.com/oca/teams/23907/am/)\n"
15+
"MIME-Version: 1.0\n"
16+
"Content-Type: text/plain; charset=UTF-8\n"
17+
"Content-Transfer-Encoding: \n"
18+
"Language: am\n"
19+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
20+
21+
#. module: document_page_approval
22+
#: model:mail.template,body_html:document_page_approval.email_template_new_draft_need_approval
23+
msgid ""
24+
"\n"
25+
" \n"
26+
"<p>Hello,</p>\n"
27+
"\n"
28+
"<p>${object.create_uid.name} submited a new Change Request for <b>${object.page_id.name}</b> and it needs your approval.</p>\n"
29+
"\n"
30+
"<h1><a href=\"${object.page_url}\">${object.display_name}</a></h1>\n"
31+
"<p>\n"
32+
"<b>Modified by:</b> ${object.create_uid.name}<br/>\n"
33+
"<b>Date:</b> ${object.create_date}<br>\n"
34+
"</p>\n"
35+
"\n"
36+
"% if object.summary:\n"
37+
"<h3>Summary</h3>\n"
38+
"<p>${object.summary}</p>\n"
39+
"% endif\n"
40+
"\n"
41+
"<h3>Diff</h3>\n"
42+
"<div style=\"overflow-x:scroll; font-size:0.85em; margin-bottom:2em;\">\n"
43+
"${object.diff|safe}\n"
44+
"</div>\n"
45+
"\n"
46+
"<p>Have a great day.</p>\n"
47+
"\n"
48+
"--<br/>\n"
49+
"\n"
50+
"<p>Odoo</p>\n"
51+
" \n"
52+
" "
53+
msgstr ""
54+
55+
#. module: document_page_approval
56+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_am_i_approver
57+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history_am_i_approver
58+
msgid "Am i approver"
59+
msgstr ""
60+
61+
#. module: document_page_approval
62+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history_am_i_owner
63+
msgid "Am i owner"
64+
msgstr ""
65+
66+
#. module: document_page_approval
67+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history_is_approval_required
68+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_is_approval_required
69+
msgid "Approval required"
70+
msgstr ""
71+
72+
#. module: document_page_approval
73+
#: model:ir.ui.view,arch_db:document_page_approval.wiki_history_form_inherit
74+
msgid "Approve"
75+
msgstr ""
76+
77+
#. module: document_page_approval
78+
#: selection:document.page.history,state:0
79+
#: model:ir.ui.view,arch_db:document_page_approval.view_wiki_history_filter
80+
msgid "Approved"
81+
msgstr ""
82+
83+
#. module: document_page_approval
84+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_approved_date
85+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history_approved_date
86+
msgid "Approved Date"
87+
msgstr ""
88+
89+
#. module: document_page_approval
90+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_approved_uid
91+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history_approved_uid
92+
msgid "Approved by"
93+
msgstr ""
94+
95+
#. module: document_page_approval
96+
#: model:ir.ui.view,arch_db:document_page_approval.view_wiki_history_filter
97+
#: model:res.groups,name:document_page_approval.group_document_approver_user
98+
msgid "Approver"
99+
msgstr ""
100+
101+
#. module: document_page_approval
102+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_approver_gid
103+
msgid "Approver group"
104+
msgstr ""
105+
106+
#. module: document_page_approval
107+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_approver_group_ids
108+
msgid "Approver groups"
109+
msgstr ""
110+
111+
#. module: document_page_approval
112+
#: model:ir.ui.view,arch_db:document_page_approval.wiki_history_form_inherit
113+
msgid "Back to draft"
114+
msgstr ""
115+
116+
#. module: document_page_approval
117+
#: model:ir.ui.view,arch_db:document_page_approval.wiki_history_form_inherit
118+
msgid "Cancel"
119+
msgstr "መሰረዝ"
120+
121+
#. module: document_page_approval
122+
#: selection:document.page.history,state:0
123+
#: model:ir.ui.view,arch_db:document_page_approval.view_wiki_history_filter
124+
msgid "Cancelled"
125+
msgstr ""
126+
127+
#. module: document_page_approval
128+
#: model:ir.actions.act_window,name:document_page_approval.action_change_requests
129+
#: model:ir.ui.menu,name:document_page_approval.menu_page_change_requests
130+
#: model:ir.ui.view,arch_db:document_page_approval.wiki_form_inherit
131+
msgid "Change Requests"
132+
msgstr ""
133+
134+
#. module: document_page_approval
135+
#: code:addons/document_page_approval/models/document_page_history_workflow.py:109
136+
#, python-format
137+
msgid "Change request <b>%s</b> has been cancelled by %s."
138+
msgstr ""
139+
140+
#. module: document_page_approval
141+
#: code:addons/document_page_approval/models/document_page_history_workflow.py:90
142+
#, python-format
143+
msgid "Change request has been approved by %s."
144+
msgstr ""
145+
146+
#. module: document_page_approval
147+
#: model:ir.model,name:document_page_approval.model_document_page
148+
msgid "Document Page"
149+
msgstr ""
150+
151+
#. module: document_page_approval
152+
#: model:ir.model,name:document_page_approval.model_document_page_history
153+
msgid "Document Page History"
154+
msgstr ""
155+
156+
#. module: document_page_approval
157+
#: selection:document.page.history,state:0
158+
#: model:ir.ui.view,arch_db:document_page_approval.view_wiki_history_filter
159+
msgid "Draft"
160+
msgstr ""
161+
162+
#. module: document_page_approval
163+
#: model:ir.model.fields,help:document_page_approval.field_document_page_approver_group_ids
164+
msgid "Groups that can approve changes to this document"
165+
msgstr ""
166+
167+
#. module: document_page_approval
168+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_has_changes_pending_approval
169+
msgid "Has changes pending approval"
170+
msgstr ""
171+
172+
#. module: document_page_approval
173+
#: model:ir.model.fields,help:document_page_approval.field_document_page_history_is_approval_required
174+
#: model:ir.model.fields,help:document_page_approval.field_document_page_is_approval_required
175+
msgid "If true, changes of this page require approval"
176+
msgstr ""
177+
178+
#. module: document_page_approval
179+
#: model:mail.template,subject:document_page_approval.email_template_new_draft_need_approval
180+
msgid "New version of ${object.display_name} needs your approval"
181+
msgstr ""
182+
183+
#. module: document_page_approval
184+
#: code:addons/document_page_approval/models/document_page_history_workflow.py:97
185+
#, python-format
186+
msgid "New version of the document %s approved."
187+
msgstr ""
188+
189+
#. module: document_page_approval
190+
#: selection:document.page.history,state:0
191+
#: model:ir.ui.view,arch_db:document_page_approval.view_wiki_history_filter
192+
msgid "Pending Approval"
193+
msgstr ""
194+
195+
#. module: document_page_approval
196+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_approval_required
197+
msgid "Require approval"
198+
msgstr ""
199+
200+
#. module: document_page_approval
201+
#: model:ir.model.fields,help:document_page_approval.field_document_page_approval_required
202+
msgid "Require approval for changes on this page or its child pages."
203+
msgstr ""
204+
205+
#. module: document_page_approval
206+
#: model:ir.ui.view,arch_db:document_page_approval.wiki_history_form_inherit
207+
msgid "Send to Review"
208+
msgstr ""
209+
210+
#. module: document_page_approval
211+
#: model:ir.ui.view,arch_db:document_page_approval.view_wiki_history_filter
212+
msgid "State"
213+
msgstr ""
214+
215+
#. module: document_page_approval
216+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history_state
217+
msgid "Status"
218+
msgstr ""
219+
220+
#. module: document_page_approval
221+
#: model:ir.ui.view,arch_db:document_page_approval.wiki_form_inherit
222+
msgid ""
223+
"This document has <b>Changes Pending Approval</b>. You are viewing the last "
224+
"approved content."
225+
msgstr ""
226+
227+
#. module: document_page_approval
228+
#: model:ir.ui.view,arch_db:document_page_approval.wiki_form_inherit
229+
msgid ""
230+
"This document requires approval. If edited, you will create a new <b>Change "
231+
"Request</b>."
232+
msgstr ""
233+
234+
#. module: document_page_approval
235+
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history_page_url
236+
msgid "URL"
237+
msgstr ""
238+
239+
#. module: document_page_approval
240+
#: model:ir.model.fields,help:document_page_approval.field_document_page_approver_gid
241+
msgid "Users must also belong to the Approvers group"
242+
msgstr ""

0 commit comments

Comments
 (0)