Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 17 additions & 30 deletions document_page_approval/README.rst
Original file line number Diff line number Diff line change
@@ -1,44 +1,40 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

======================
Document Page Approval
======================

This module adds a workflow to approve page modification and show the approved
version by default.
This module adds a workflow to approve page modifications and show the approved version by default.

Installation
============

Makes the document page approval available from where some users can approved the modifications
made by others users in documents that required approvement.
No specific installation required.

Configuration
=============

No configuration required
* Set a valid email address on the company settings.
* Go to Knowledge > Categories.
* Create a new page category and set an approver group. Make sure users belonging to that group have valid email
addresses.

Usage
=====

To use this module, you need to:

* Set a valid email address on the company settings.
* go to knowledge > Categories.
* Create a new page category and set an approver group. Make sure users
belonging to that group have valid email addresses.
* go to knowledge > Pages
* Go to Knowledge > Pages
* Create a new page and choose the previously created category.
* A notification is sent to the group with a link to the page history to
review.
* A notification is sent to the approvers group with a link to the page history to review.
* Depending on the review, the page history is approved or not.
* Users reading the page see the last approved version.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/118/9.0
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/118/10.0

Known issues / Roadmap
======================
Expand All @@ -50,8 +46,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/
knowledge/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback `here <https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_approval%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

If you spotted it first, help us smashing it by providing a detailed and welcomed feedback `here <https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_approval%0Aversion:%2010.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======
Expand All @@ -62,27 +57,19 @@ Contributors
* Odoo SA <info@odoo.com>
* Savoir-faire Linux <support@savoirfairelinux.com>
* Gervais Naoussi <gervaisnaoussi@gmail.com>
* Maxime Chambreuil <mchambreuil@ursainfosystems.com>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.

Changelog
---------

v9.0.1.0.0

Here are the modification that have been done:

* The module does no depends anymore on email_template but on mail module
To contribute to this module, please visit https://odoo-community.org.
22 changes: 3 additions & 19 deletions document_page_approval/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
28 changes: 4 additions & 24 deletions document_page_approval/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,15 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Document Page Approval',
'version': '9.0.1.0.0',
"author": "Savoir-faire Linux,Odoo Community Association (OCA)",
'version': '10.0.1.0.0',
"author": "Savoir-faire Linux, Odoo Community Association (OCA)",
"website": "http://www.savoirfairelinux.com",
"license": "AGPL-3",
'category': 'Knowledge Management',
'depends': [
'knowledge',
'document_page',
'mail',
],
Expand All @@ -38,8 +20,6 @@
'security/document_page_security.xml',
'security/ir.model.access.csv',
],
'installable': False,
'auto_install': False,
'images': [
'images/category.png',
'images/page_history_list.png',
Expand Down
30 changes: 13 additions & 17 deletions document_page_approval/data/email_template.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
<?xml version="1.0"?>
<odoo>
<odoo noupdate="1">

<!-- Allow user to make upgrade-proof customizations to email template -->

<data noupdate="1">

<record id="email_template_new_draft_need_approval" model="mail.template">
<field name="name">Automated new draft need approval Notification Mail</field>
<field name="email_from">${object.create_uid.company_id.email or 'noreply@localhost.com'}</field>
<field name="subject">New version of "${object.page_id.name}" to approve</field>
<field name="email_to">${object.get_approvers_email}</field>
<field name="model_id" ref="model_document_page_history"/>
<field name="auto_delete" eval="True"/>
<field name="lang">${object.create_uid.partner_id.lang}</field>
<field name="body_html">
<![CDATA[
<record id="email_template_new_draft_need_approval" model="mail.template">
<field name="name">Automated new draft need approval Notification Mail</field>
<field name="email_from">${object.create_uid.company_id.email or 'noreply@localhost.com'}</field>
<field name="subject">New version of "${object.page_id.name}" to approve</field>
<field name="email_to">${object.get_approvers_email}</field>
<field name="model_id" ref="model_document_page_history"/>
<field name="auto_delete" eval="True"/>
<field name="lang">${object.create_uid.partner_id.lang}</field>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be in the approver language, not the page author's one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LeartS There could be many approvers with different languages. If they need to approve the content, I assumed they can at least read in the language of the creator.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the creator language is definitely ok too, I was just wondering if there was a way to send each mail in the recipient language (isn't there a way to get the recipient in the evaluation context / variables?).

Also note that the author language is not necessarily the document language, imagine for example a global company where each employee sets their own language in their preferences, but they all contribute to documentation in english.

Anyway, I'm nitpicking. The author language is ok.

<field name="body_html">
<![CDATA[
<p>Hello,</p>

<p>The page "${object.page_id.name}" has been modified and need your approval.</p>
Expand All @@ -24,8 +21,7 @@
<p>Have a great day.<br/>
--<br/>
Odoo</p>]]>
</field>
</record>
</field>
</record>

</data>
</odoo>
21 changes: 2 additions & 19 deletions document_page_approval/models/document_page_approval.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields, api

Expand Down
27 changes: 5 additions & 22 deletions document_page_approval/models/document_page_history_workflow.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from datetime import datetime
from openerp.tools.translate import _
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from openerp import models, fields, api
from odoo.tools.translate import _
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
from odoo import api, fields, models


class DocumentPageHistoryWorkflow(models.Model):
Expand Down
4 changes: 2 additions & 2 deletions document_page_approval/security/document_page_security.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">

<record id="group_document_approver_user" model="res.groups">
<field name="name">Document approver</field>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
</data>

</odoo>
2 changes: 2 additions & 0 deletions document_page_approval/views/document_page_approval.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<odoo>

<record id="wiki_history_form_inherit" model="ir.ui.view">
<field name="name">document.page.history.form</field>
<field name="model">document.page.history</field>
Expand Down Expand Up @@ -88,4 +89,5 @@
</field>
</field>
</record>

</odoo>
2 changes: 2 additions & 0 deletions document_page_approval/workflows/document_page_approval.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<odoo>

<record model="workflow" id="wkf_document_page_history_aproval">
<field name="name">document.page.history.aproval.wkf</field>
<field name="osv">document.page.history</field>
Expand Down Expand Up @@ -35,4 +36,5 @@
<field name="act_to" ref="act_draft" />
<field name="signal">edit</field>
</record>

</odoo>