Skip to content

Commit 2ef6ef8

Browse files
committed
Merge PR #573 into 19.0
Signed-off-by max3903
2 parents 148d6e2 + cd02f86 commit 2ef6ef8

92 files changed

Lines changed: 29581 additions & 0 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: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
5+
======================
6+
Document Page Approval
7+
======================
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:ad1f0f3942df59076ffe4ebdf9ba440842d2792c5a1932cfd434ce9f20448e87
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Beta
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22+
:alt: License: AGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github
24+
:target: https://github.com/OCA/knowledge/tree/19.0/document_page_approval
25+
:alt: OCA/knowledge
26+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27+
:target: https://translation.odoo-community.org/projects/knowledge-19-0/knowledge-19-0-document_page_approval
28+
:alt: Translate me on Weblate
29+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=19.0
31+
:alt: Try me on Runboat
32+
33+
|badge1| |badge2| |badge3| |badge4| |badge5|
34+
35+
This module adds a workflow to approve page modifications and show the
36+
approved version by default.
37+
38+
**Table of contents**
39+
40+
.. contents::
41+
:local:
42+
43+
Configuration
44+
=============
45+
46+
To configure this module, you need to:
47+
48+
1. Set a valid email address on the company settings.
49+
2. Go to Knowledge > Categories.
50+
3. Create a new page category and set an approver group. Make sure users
51+
belonging to that group have valid email addresses.
52+
53+
Usage
54+
=====
55+
56+
To use this module, you need to:
57+
58+
1. Go to Knowledge > Pages
59+
2. Create a new page and choose the previously created category.
60+
3. A notification is sent to the approvers group with a link to the page
61+
history to review.
62+
4. Depending on the review, the page history is approved or not.
63+
5. Users reading the page see the last approved version.
64+
65+
Bug Tracker
66+
===========
67+
68+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_.
69+
In case of trouble, please check there if your issue has already been reported.
70+
If you spotted it first, help us to smash it by providing a detailed and welcomed
71+
`feedback <https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_approval%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
72+
73+
Do not contact contributors directly about support or help with technical issues.
74+
75+
Credits
76+
=======
77+
78+
Authors
79+
-------
80+
81+
* Savoir-faire Linux
82+
83+
Contributors
84+
------------
85+
86+
- Odoo SA <info@odoo.com>
87+
88+
- Savoir-faire Linux <support@savoirfairelinux.com>
89+
90+
- Gervais Naoussi <gervaisnaoussi@gmail.com>
91+
92+
- Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
93+
94+
- Iván Todorovich <ivan.todorovich@gmail.com>
95+
96+
- `Tecnativa <https://www.tecnativa.com>`__:
97+
98+
- Victor M.M. Torres
99+
- Víctor Martínez
100+
101+
- `Guadaltech <https://www.guadaltech.es>`__:
102+
103+
- Fernando La Chica <fernando.lachica@guadaltech.es>
104+
105+
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__
106+
107+
- Bhavesh Heliconia
108+
109+
Maintainers
110+
-----------
111+
112+
This module is maintained by the OCA.
113+
114+
.. image:: https://odoo-community.org/logo.png
115+
:alt: Odoo Community Association
116+
:target: https://odoo-community.org
117+
118+
OCA, or the Odoo Community Association, is a nonprofit organization whose
119+
mission is to support the collaborative development of Odoo features and
120+
promote its widespread use.
121+
122+
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/19.0/document_page_approval>`_ project on GitHub.
123+
124+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

document_page_approval/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from . import models
5+
from .hooks import post_init_hook, uninstall_hook
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Document Page Approval",
6+
"version": "19.0.1.0.0",
7+
"author": "Savoir-faire Linux, Odoo Community Association (OCA)",
8+
"website": "https://github.com/OCA/knowledge",
9+
"license": "AGPL-3",
10+
"category": "Knowledge Management",
11+
"depends": ["document_page", "mail"],
12+
"data": [
13+
"data/email_template.xml",
14+
"views/document_page_approval.xml",
15+
"security/document_page_security.xml",
16+
],
17+
"images": [
18+
"images/category.png",
19+
"images/page_history_list.png",
20+
"images/page_history.png",
21+
],
22+
"post_init_hook": "post_init_hook",
23+
"uninstall_hook": "uninstall_hook",
24+
"installable": True,
25+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo>
3+
<!-- If user wants to make upgrade-proof customizations to email templates, he should edit ir.model.data and check noupdate himself -->
4+
<record id="email_template_new_draft_need_approval" model="mail.template">
5+
<field name="name">Automated new draft need approval Notification Mail</field>
6+
<field
7+
name="email_from"
8+
>{{object.create_uid.company_id.email or 'noreply@localhost.com'}}</field>
9+
<field
10+
name="subject"
11+
>New version of {{object.display_name}} needs your approval</field>
12+
<field name="model_id" ref="model_document_page_history" />
13+
<field name="auto_delete" eval="True" />
14+
<field name="lang">{{object.create_uid.partner_id.lang}}</field>
15+
<field name="body_html" type="html">
16+
<p>Hello,</p>
17+
<p><t t-out="object.create_uid.name" /> submited a new Change Request for <b
18+
t-out="object.page_id.name"
19+
/> and it needs your approval.</p>
20+
<h1>
21+
<a t-att-href="object.page_url" t-out="object.display_name" />
22+
</h1>
23+
<p>
24+
<b>Modified by:</b>
25+
<t t-out="object.create_uid.name" />
26+
</p>
27+
<p>
28+
<b>Date:</b>
29+
<t t-out="object.create_date" />
30+
</p>
31+
<t t-if="object.summary">
32+
<h3>Summary</h3>
33+
<p t-out="object.summary" />
34+
</t>
35+
<h3>Diff</h3>
36+
<div style="overflow-x:scroll; font-size:0.85em; margin-bottom:2em;">
37+
<t t-out="object.diff" />
38+
</div>
39+
<p>Have a great day.</p>
40+
<br />
41+
<p>Odoo</p>
42+
</field>
43+
</record>
44+
</odoo>

document_page_approval/hooks.py

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

0 commit comments

Comments
 (0)