[MIG] document_page_approval: Migration to 15.0

TT36950

[UPD] Update document_page_approval.pot

[UPD] README.rst
This commit is contained in:
Víctor Martínez 2022-07-26 13:21:07 +02:00 committed by Bhavesh Heliconia
parent 705bf60493
commit a045036e67
8 changed files with 38 additions and 55 deletions

View File

@ -14,13 +14,13 @@ Document Page Approval
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github .. |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 :alt: OCA/knowledge
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |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 :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |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 :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -61,7 +61,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_. 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. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_approval%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_approval%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. 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 mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/14.0/document_page_approval>`_ project on GitHub. This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/15.0/document_page_approval>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -3,7 +3,7 @@
{ {
"name": "Document Page Approval", "name": "Document Page Approval",
"version": "14.0.1.0.0", "version": "15.0.1.0.0",
"author": "Savoir-faire Linux, Odoo Community Association (OCA)", "author": "Savoir-faire Linux, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/knowledge", "website": "https://github.com/OCA/knowledge",
"license": "AGPL-3", "license": "AGPL-3",

View File

@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 14.0\n" "Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -120,6 +120,11 @@ msgstr ""
msgid "Attachment Count" msgid "Attachment Count"
msgstr "" 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 #. module: document_page_approval
#: model_terms:ir.ui.view,arch_db:document_page_approval.wiki_history_form_inherit #: model_terms:ir.ui.view,arch_db:document_page_approval.wiki_history_form_inherit
msgid "Back to draft" msgid "Back to draft"
@ -158,7 +163,7 @@ msgstr ""
#. module: document_page_approval #. module: document_page_approval
#: code:addons/document_page_approval/models/document_page_history.py:0 #: code:addons/document_page_approval/models/document_page_history.py:0
#, python-format #, python-format
msgid "Change request <b>%s</b> has been cancelled by %s." msgid "Change request <b>%(name)s</b> has been cancelled by %(user)s."
msgstr "" msgstr ""
#. module: document_page_approval #. module: document_page_approval
@ -167,12 +172,6 @@ msgstr ""
msgid "Change request has been approved by %s." msgid "Change request has been approved by %s."
msgstr "" 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 #. module: document_page_approval
#: model:ir.model,name:document_page_approval.model_document_page #: model:ir.model,name:document_page_approval.model_document_page
msgid "Document Page" msgid "Document Page"
@ -194,11 +193,6 @@ msgstr ""
msgid "Followers" msgid "Followers"
msgstr "" 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 #. module: document_page_approval
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history__message_partner_ids #: model:ir.model.fields,field_description:document_page_approval.field_document_page_history__message_partner_ids
msgid "Followers (Partners)" msgid "Followers (Partners)"
@ -209,6 +203,11 @@ msgstr ""
msgid "Groups that can approve changes to this document" msgid "Groups that can approve changes to this document"
msgstr "" 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 #. module: document_page_approval
#: model:ir.model.fields,field_description:document_page_approval.field_document_page__has_changes_pending_approval #: model:ir.model.fields,field_description:document_page_approval.field_document_page__has_changes_pending_approval
msgid "Has changes pending approval" msgid "Has changes pending approval"
@ -219,12 +218,6 @@ msgstr ""
msgid "History" msgid "History"
msgstr "" 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 #. 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_needaction
#: model:ir.model.fields,help:document_page_approval.field_document_page_history__message_unread #: model:ir.model.fields,help:document_page_approval.field_document_page_history__message_unread
@ -248,12 +241,6 @@ msgstr ""
msgid "Is Follower" msgid "Is Follower"
msgstr "" 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 #. module: document_page_approval
#: model:ir.model.fields,field_description:document_page_approval.field_document_page_history__message_main_attachment_id #: model:ir.model.fields,field_description:document_page_approval.field_document_page_history__message_main_attachment_id
msgid "Main Attachment" msgid "Main Attachment"
@ -380,16 +367,6 @@ msgstr ""
msgid "Users must also belong to the Approvers group" msgid "Users must also belong to the Approvers group"
msgstr "" 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 #. module: document_page_approval
#: code:addons/document_page_approval/models/document_page_history.py:0 #: code:addons/document_page_approval/models/document_page_history.py:0
#, python-format #, python-format

View File

@ -156,8 +156,8 @@ msgstr ""
#. module: document_page_approval #. module: document_page_approval
#: code:addons/document_page_approval/models/document_page_history.py:0 #: code:addons/document_page_approval/models/document_page_history.py:0
#, python-format #, python-format
msgid "Change request <b>%s</b> has been cancelled by %s." msgid "Change request <b>%(name)s</b> has been cancelled by %(user)s."
msgstr "" msgstr "El cambio solicitado <b>%(name)s</b> ha sido cancelado por %(user)s."
#. module: document_page_approval #. module: document_page_approval
#: code:addons/document_page_approval/models/document_page_history.py:0 #: code:addons/document_page_approval/models/document_page_history.py:0

View File

@ -12,9 +12,7 @@ class DocumentPage(models.Model):
_inherit = "document.page" _inherit = "document.page"
history_ids = fields.One2many( history_ids = fields.One2many(domain=[("state", "=", "approved")])
order="approved_date DESC", domain=[("state", "=", "approved")]
)
approved_date = fields.Datetime( approved_date = fields.Datetime(
"Approved Date", "Approved Date",
@ -48,6 +46,7 @@ class DocumentPage(models.Model):
"Approval required", "Approval required",
help="If true, changes of this page require approval", help="If true, changes of this page require approval",
compute="_compute_is_approval_required", compute="_compute_is_approval_required",
recursive=True,
) )
am_i_approver = fields.Boolean(compute="_compute_am_i_approver") am_i_approver = fields.Boolean(compute="_compute_am_i_approver")
@ -57,8 +56,10 @@ class DocumentPage(models.Model):
string="Approver groups", string="Approver groups",
help="Groups that can approve changes to this document", help="Groups that can approve changes to this document",
compute="_compute_approver_group_ids", compute="_compute_approver_group_ids",
recursive=True,
) )
# pylint: disable=W8113
has_changes_pending_approval = fields.Boolean( has_changes_pending_approval = fields.Boolean(
compute="_compute_has_changes_pending_approval", compute="_compute_has_changes_pending_approval",
string="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?" 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") @api.depends("approval_required", "parent_id.is_approval_required")
def _compute_is_approval_required(self): def _compute_is_approval_required(self):
"""Check if the document required approval based on his parents.""" """Check if the document required approval based on his parents."""
@ -127,13 +131,14 @@ class DocumentPage(models.Model):
rec.user_has_drafts = changes > 0 rec.user_has_drafts = changes > 0
def _create_history(self, vals): def _create_history(self, vals):
res = super(DocumentPage, self)._create_history(vals) res = super()._create_history(vals)
res.action_to_approve() res.action_to_approve()
return res
def action_changes_pending_approval(self): def action_changes_pending_approval(self):
self.ensure_one() self.ensure_one()
action = self.env.ref("document_page_approval.action_change_requests") 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 = literal_eval(action["context"])
context["search_default_page_id"] = self.id context["search_default_page_id"] = self.id
context["default_page_id"] = self.id context["default_page_id"] = self.id

View File

@ -11,6 +11,7 @@ class DocumentPageHistory(models.Model):
_name = "document.page.history" _name = "document.page.history"
_inherit = ["document.page.history", "mail.thread"] _inherit = ["document.page.history", "mail.thread"]
_order = "approved_date DESC, id DESC"
state = fields.Selection( state = fields.Selection(
[ [
@ -24,7 +25,7 @@ class DocumentPageHistory(models.Model):
readonly=True, readonly=True,
) )
approved_date = fields.Datetime("Approved Date") approved_date = fields.Datetime()
approved_uid = fields.Many2one("res.users", "Approved by") approved_uid = fields.Many2one("res.users", "Approved by")
@ -126,8 +127,8 @@ class DocumentPageHistory(models.Model):
for rec in self: for rec in self:
rec.message_post( rec.message_post(
subtype_xmlid="mail.mt_comment", subtype_xmlid="mail.mt_comment",
body=_("Change request <b>%s</b> has been cancelled by %s.") body=_("Change request <b>%(name)s</b> has been cancelled by %(user)s.")
% (rec.display_name, self.env.user.name), % ({"name": rec.display_name, "user": self.env.user.name}),
) )
def action_cancel_and_draft(self): def action_cancel_and_draft(self):

View File

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/knowledge/tree/14.0/document_page_approval"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/knowledge-14-0/knowledge-14-0-document_page_approval"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/118/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/knowledge/tree/15.0/document_page_approval"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/knowledge-15-0/knowledge-15-0-document_page_approval"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/118/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module adds a workflow to approve page modifications <p>This module adds a workflow to approve page modifications
and show the approved version by default.</p> and show the approved version by default.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
@ -411,7 +411,7 @@ page history to review.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/knowledge/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/knowledge/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_approval%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_approval%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -444,7 +444,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/14.0/document_page_approval">OCA/knowledge</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/15.0/document_page_approval">OCA/knowledge</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@ -3,7 +3,7 @@ from odoo.tests import common
class TestDocumentPageApproval(common.TransactionCase): class TestDocumentPageApproval(common.TransactionCase):
def setUp(self): def setUp(self):
super(TestDocumentPageApproval, self).setUp() super().setUp()
self.page_obj = self.env["document.page"] self.page_obj = self.env["document.page"]
self.history_obj = self.env["document.page.history"] self.history_obj = self.env["document.page.history"]
# demo # demo