diff --git a/document_page_approval/README.rst b/document_page_approval/README.rst
index e41afd62..8866d5d4 100644
--- a/document_page_approval/README.rst
+++ b/document_page_approval/README.rst
@@ -14,13 +14,13 @@ Document Page Approval
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github
- :target: https://github.com/OCA/knowledge/tree/14.0/document_page_approval
+ :target: https://github.com/OCA/knowledge/tree/15.0/document_page_approval
:alt: OCA/knowledge
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/knowledge-14-0/knowledge-14-0-document_page_approval
+ :target: https://translation.odoo-community.org/projects/knowledge-15-0/knowledge-15-0-document_page_approval
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/118/14.0
+ :target: https://runbot.odoo-community.org/runbot/118/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -61,7 +61,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -100,6 +100,6 @@ 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.
-This module is part of the `OCA/knowledge `_ project on GitHub.
+This module is part of the `OCA/knowledge `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/document_page_approval/__manifest__.py b/document_page_approval/__manifest__.py
index eaf8b91e..57dce431 100644
--- a/document_page_approval/__manifest__.py
+++ b/document_page_approval/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Document Page Approval",
- "version": "14.0.1.0.0",
+ "version": "15.0.1.0.0",
"author": "Savoir-faire Linux, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/knowledge",
"license": "AGPL-3",
diff --git a/document_page_approval/i18n/document_page_approval.pot b/document_page_approval/i18n/document_page_approval.pot
index a30f9dd6..42dc16a9 100644
--- a/document_page_approval/i18n/document_page_approval.pot
+++ b/document_page_approval/i18n/document_page_approval.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 14.0\n"
+"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -120,6 +120,11 @@ msgstr ""
msgid "Attachment Count"
msgstr ""
+#. module: document_page_approval
+#: model:mail.template,name:document_page_approval.email_template_new_draft_need_approval
+msgid "Automated new draft need approval Notification Mail"
+msgstr ""
+
#. module: document_page_approval
#: model_terms:ir.ui.view,arch_db:document_page_approval.wiki_history_form_inherit
msgid "Back to draft"
@@ -158,7 +163,7 @@ msgstr ""
#. module: document_page_approval
#: code:addons/document_page_approval/models/document_page_history.py:0
#, python-format
-msgid "Change request %s has been cancelled by %s."
+msgid "Change request %(name)s has been cancelled by %(user)s."
msgstr ""
#. module: document_page_approval
@@ -167,12 +172,6 @@ msgstr ""
msgid "Change request has been approved by %s."
msgstr ""
-#. module: document_page_approval
-#: model:ir.model.fields,field_description:document_page_approval.field_document_page__display_name
-#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history__display_name
-msgid "Display Name"
-msgstr ""
-
#. module: document_page_approval
#: model:ir.model,name:document_page_approval.model_document_page
msgid "Document Page"
@@ -194,11 +193,6 @@ msgstr ""
msgid "Followers"
msgstr ""
-#. module: document_page_approval
-#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history__message_channel_ids
-msgid "Followers (Channels)"
-msgstr ""
-
#. module: document_page_approval
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history__message_partner_ids
msgid "Followers (Partners)"
@@ -209,6 +203,11 @@ msgstr ""
msgid "Groups that can approve changes to this document"
msgstr ""
+#. module: document_page_approval
+#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history__has_message
+msgid "Has Message"
+msgstr ""
+
#. module: document_page_approval
#: model:ir.model.fields,field_description:document_page_approval.field_document_page__has_changes_pending_approval
msgid "Has changes pending approval"
@@ -219,12 +218,6 @@ msgstr ""
msgid "History"
msgstr ""
-#. module: document_page_approval
-#: model:ir.model.fields,field_description:document_page_approval.field_document_page__id
-#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history__id
-msgid "ID"
-msgstr ""
-
#. module: document_page_approval
#: model:ir.model.fields,help:document_page_approval.field_document_page_history__message_needaction
#: model:ir.model.fields,help:document_page_approval.field_document_page_history__message_unread
@@ -248,12 +241,6 @@ msgstr ""
msgid "Is Follower"
msgstr ""
-#. module: document_page_approval
-#: model:ir.model.fields,field_description:document_page_approval.field_document_page____last_update
-#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history____last_update
-msgid "Last Modified on"
-msgstr ""
-
#. module: document_page_approval
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history__message_main_attachment_id
msgid "Main Attachment"
@@ -380,16 +367,6 @@ msgstr ""
msgid "Users must also belong to the Approvers group"
msgstr ""
-#. module: document_page_approval
-#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history__website_message_ids
-msgid "Website Messages"
-msgstr ""
-
-#. module: document_page_approval
-#: model:ir.model.fields,help:document_page_approval.field_document_page_history__website_message_ids
-msgid "Website communication history"
-msgstr ""
-
#. module: document_page_approval
#: code:addons/document_page_approval/models/document_page_history.py:0
#, python-format
diff --git a/document_page_approval/i18n/es.po b/document_page_approval/i18n/es.po
index 146e1ee1..1b0b2f23 100644
--- a/document_page_approval/i18n/es.po
+++ b/document_page_approval/i18n/es.po
@@ -156,8 +156,8 @@ msgstr ""
#. module: document_page_approval
#: code:addons/document_page_approval/models/document_page_history.py:0
#, python-format
-msgid "Change request %s has been cancelled by %s."
-msgstr ""
+msgid "Change request %(name)s has been cancelled by %(user)s."
+msgstr "El cambio solicitado %(name)s ha sido cancelado por %(user)s."
#. module: document_page_approval
#: code:addons/document_page_approval/models/document_page_history.py:0
diff --git a/document_page_approval/models/document_page.py b/document_page_approval/models/document_page.py
index a4528f0e..d0b6ad2c 100644
--- a/document_page_approval/models/document_page.py
+++ b/document_page_approval/models/document_page.py
@@ -12,9 +12,7 @@ class DocumentPage(models.Model):
_inherit = "document.page"
- history_ids = fields.One2many(
- order="approved_date DESC", domain=[("state", "=", "approved")]
- )
+ history_ids = fields.One2many(domain=[("state", "=", "approved")])
approved_date = fields.Datetime(
"Approved Date",
@@ -48,6 +46,7 @@ class DocumentPage(models.Model):
"Approval required",
help="If true, changes of this page require approval",
compute="_compute_is_approval_required",
+ recursive=True,
)
am_i_approver = fields.Boolean(compute="_compute_am_i_approver")
@@ -57,8 +56,10 @@ class DocumentPage(models.Model):
string="Approver groups",
help="Groups that can approve changes to this document",
compute="_compute_approver_group_ids",
+ recursive=True,
)
+ # pylint: disable=W8113
has_changes_pending_approval = fields.Boolean(
compute="_compute_has_changes_pending_approval",
string="Has changes pending approval",
@@ -68,6 +69,9 @@ class DocumentPage(models.Model):
compute="_compute_user_has_drafts", string="User has drafts?"
)
+ def _valid_field_parameter(self, field, name):
+ return name == "order" or super()._valid_field_parameter(field, name)
+
@api.depends("approval_required", "parent_id.is_approval_required")
def _compute_is_approval_required(self):
"""Check if the document required approval based on his parents."""
@@ -127,13 +131,14 @@ class DocumentPage(models.Model):
rec.user_has_drafts = changes > 0
def _create_history(self, vals):
- res = super(DocumentPage, self)._create_history(vals)
+ res = super()._create_history(vals)
res.action_to_approve()
+ return res
def action_changes_pending_approval(self):
self.ensure_one()
action = self.env.ref("document_page_approval.action_change_requests")
- action = action.read()[0]
+ action = action.sudo().read()[0]
context = literal_eval(action["context"])
context["search_default_page_id"] = self.id
context["default_page_id"] = self.id
diff --git a/document_page_approval/models/document_page_history.py b/document_page_approval/models/document_page_history.py
index 933496c4..7502047e 100644
--- a/document_page_approval/models/document_page_history.py
+++ b/document_page_approval/models/document_page_history.py
@@ -11,6 +11,7 @@ class DocumentPageHistory(models.Model):
_name = "document.page.history"
_inherit = ["document.page.history", "mail.thread"]
+ _order = "approved_date DESC, id DESC"
state = fields.Selection(
[
@@ -24,7 +25,7 @@ class DocumentPageHistory(models.Model):
readonly=True,
)
- approved_date = fields.Datetime("Approved Date")
+ approved_date = fields.Datetime()
approved_uid = fields.Many2one("res.users", "Approved by")
@@ -126,8 +127,8 @@ class DocumentPageHistory(models.Model):
for rec in self:
rec.message_post(
subtype_xmlid="mail.mt_comment",
- body=_("Change request %s has been cancelled by %s.")
- % (rec.display_name, self.env.user.name),
+ body=_("Change request %(name)s has been cancelled by %(user)s.")
+ % ({"name": rec.display_name, "user": self.env.user.name}),
)
def action_cancel_and_draft(self):
diff --git a/document_page_approval/static/description/index.html b/document_page_approval/static/description/index.html
index 5e34414d..9e8bf7dd 100644
--- a/document_page_approval/static/description/index.html
+++ b/document_page_approval/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This module adds a workflow to approve page modifications
and show the approved version by default.
Table of contents
@@ -411,7 +411,7 @@ page history to review.
Bugs are tracked on GitHub 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.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -444,7 +444,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
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.
-
This module is part of the OCA/knowledge project on GitHub.
+
This module is part of the OCA/knowledge project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/document_page_approval/tests/test_document_page_approval.py b/document_page_approval/tests/test_document_page_approval.py
index b26fb092..6d0971c3 100644
--- a/document_page_approval/tests/test_document_page_approval.py
+++ b/document_page_approval/tests/test_document_page_approval.py
@@ -3,7 +3,7 @@ from odoo.tests import common
class TestDocumentPageApproval(common.TransactionCase):
def setUp(self):
- super(TestDocumentPageApproval, self).setUp()
+ super().setUp()
self.page_obj = self.env["document.page"]
self.history_obj = self.env["document.page.history"]
# demo