diff --git a/document_page/models/document_page_history.py b/document_page/models/document_page_history.py index 35ddb392..7b200e6a 100644 --- a/document_page/models/document_page_history.py +++ b/document_page/models/document_page_history.py @@ -66,11 +66,5 @@ class DocumentPageHistory(models.Model): context=True, ) - # TODO: Replace for _compute_display_name def name_get(self): return [(rec.id, "%s #%i" % (rec.page_id.name, rec.id)) for rec in self] - - @api.depends("page_id") - def _compute_display_name(self): - for rec in self: - rec.display_name = rec.id, "%s #%i" % (rec.page_id.name, rec.id) diff --git a/document_page_approval/README.rst b/document_page_approval/README.rst index 64f67ea1..72b48e44 100644 --- a/document_page_approval/README.rst +++ b/document_page_approval/README.rst @@ -17,19 +17,19 @@ 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/16.0/document_page_approval + :target: https://github.com/OCA/knowledge/tree/17.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-16-0/knowledge-16-0-document_page_approval + :target: https://translation.odoo-community.org/projects/knowledge-17-0/knowledge-17-0-document_page_approval :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -This module adds a workflow to approve page modifications -and show the approved version by default. +This module adds a workflow to approve page modifications and show the +approved version by default. **Table of contents** @@ -41,22 +41,22 @@ Configuration To configure 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. +1. Set a valid email address on the company settings. +2. Go to Knowledge > Categories. +3. 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: -#. Go to Knowledge > Pages -#. Create a new page and choose the previously created category. -#. 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. +1. Go to Knowledge > Pages +2. Create a new page and choose the previously created category. +3. A notification is sent to the approvers group with a link to the page + history to review. +4. Depending on the review, the page history is approved or not. +5. Users reading the page see the last approved version. Bug Tracker =========== @@ -64,7 +64,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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -72,30 +72,34 @@ Credits ======= Authors -~~~~~~~ +------- * Savoir-faire Linux Contributors -~~~~~~~~~~~~ +------------ -* Odoo SA -* Savoir-faire Linux -* Gervais Naoussi -* Maxime Chambreuil -* Iván Todorovich +- Odoo SA -* `Tecnativa `_: +- Savoir-faire Linux - * Victor M.M. Torres - * Víctor Martínez +- Gervais Naoussi -* `Guadaltech `_: +- Maxime Chambreuil - * Fernando La Chica +- Iván Todorovich + +- `Tecnativa `__: + + - Victor M.M. Torres + - Víctor Martínez + +- `Guadaltech `__: + + - Fernando La Chica Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -107,6 +111,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 648f4c64..f2ca320a 100644 --- a/document_page_approval/__manifest__.py +++ b/document_page_approval/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Document Page Approval", - "version": "16.0.1.1.1", + "version": "17.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/hooks.py b/document_page_approval/hooks.py index d0b780a2..5eb8761b 100644 --- a/document_page_approval/hooks.py +++ b/document_page_approval/hooks.py @@ -5,10 +5,10 @@ import logging _logger = logging.getLogger(__name__) -def post_init_hook(cr, registry): # pragma: no cover +def post_init_hook(env): # pragma: no cover # Set all pre-existing pages history to approved _logger.info("Setting history to approved.") - cr.execute( + env.cr.execute( """ UPDATE document_page_history SET state='approved', @@ -19,7 +19,7 @@ def post_init_hook(cr, registry): # pragma: no cover ) -def uninstall_hook(cr, registry): # pragma: no cover +def uninstall_hook(env): # pragma: no cover # Remove unapproved pages _logger.info("Deleting unapproved Change Requests.") - cr.execute("DELETE FROM document_page_history WHERE state != 'approved'") + env.cr.execute("DELETE FROM document_page_history WHERE state != 'approved'") diff --git a/document_page_approval/images/category.png b/document_page_approval/images/category.png index b88e2091..410f661e 100644 Binary files a/document_page_approval/images/category.png and b/document_page_approval/images/category.png differ diff --git a/document_page_approval/images/page_history.png b/document_page_approval/images/page_history.png index 80bee3c3..7612df7f 100644 Binary files a/document_page_approval/images/page_history.png and b/document_page_approval/images/page_history.png differ diff --git a/document_page_approval/images/page_history_list.png b/document_page_approval/images/page_history_list.png index a2f52232..2cefe8a1 100644 Binary files a/document_page_approval/images/page_history_list.png and b/document_page_approval/images/page_history_list.png differ diff --git a/document_page_approval/models/document_page.py b/document_page_approval/models/document_page.py index d0b6ad2c..ccfcaa87 100644 --- a/document_page_approval/models/document_page.py +++ b/document_page_approval/models/document_page.py @@ -19,7 +19,6 @@ class DocumentPage(models.Model): related="history_head.approved_date", store=True, index=True, - readonly=True, ) approved_uid = fields.Many2one( @@ -28,7 +27,6 @@ class DocumentPage(models.Model): related="history_head.approved_uid", store=True, index=True, - readonly=True, ) approval_required = fields.Boolean( @@ -137,8 +135,9 @@ class DocumentPage(models.Model): def action_changes_pending_approval(self): self.ensure_one() - action = self.env.ref("document_page_approval.action_change_requests") - action = action.sudo().read()[0] + action = self.env["ir.actions.act_window"]._for_xml_id( + "document_page_approval.action_change_requests" + ) 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 905e6f0b..1c988b6c 100644 --- a/document_page_approval/models/document_page_history.py +++ b/document_page_approval/models/document_page_history.py @@ -22,7 +22,6 @@ class DocumentPageHistory(models.Model): ], "Status", default="draft", - readonly=True, ) approved_date = fields.Datetime() @@ -79,7 +78,7 @@ class DocumentPageHistory(models.Model): [("groups_id", "in", guids), ("groups_id", "in", approver_gid.id)] ) rec.message_subscribe(partner_ids=users.mapped("partner_id").ids) - rec.message_post_with_template(template.id) + rec.message_post_with_source(template) else: # auto-approve if approval is not required rec.action_approve() diff --git a/document_page_approval/pyproject.toml b/document_page_approval/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/document_page_approval/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/document_page_approval/readme/CONFIGURE.md b/document_page_approval/readme/CONFIGURE.md new file mode 100644 index 00000000..8b105217 --- /dev/null +++ b/document_page_approval/readme/CONFIGURE.md @@ -0,0 +1,6 @@ +To configure this module, you need to: + +1. Set a valid email address on the company settings. +2. Go to Knowledge \> Categories. +3. Create a new page category and set an approver group. Make sure + users belonging to that group have valid email addresses. diff --git a/document_page_approval/readme/CONFIGURE.rst b/document_page_approval/readme/CONFIGURE.rst deleted file mode 100644 index 1a123ecd..00000000 --- a/document_page_approval/readme/CONFIGURE.rst +++ /dev/null @@ -1,6 +0,0 @@ -To configure 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. diff --git a/document_page_approval/readme/CONTRIBUTORS.md b/document_page_approval/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..52c3c13d --- /dev/null +++ b/document_page_approval/readme/CONTRIBUTORS.md @@ -0,0 +1,18 @@ +- Odoo SA \<\> + +- Savoir-faire Linux \<\> + +- Gervais Naoussi \<\> + +- Maxime Chambreuil \<\> + +- Iván Todorovich \<\> + +- [Tecnativa](https://www.tecnativa.com): + + > - Victor M.M. Torres + > - Víctor Martínez + +- [Guadaltech](https://www.guadaltech.es): + + - Fernando La Chica \<\> diff --git a/document_page_approval/readme/CONTRIBUTORS.rst b/document_page_approval/readme/CONTRIBUTORS.rst deleted file mode 100644 index a06acbda..00000000 --- a/document_page_approval/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,14 +0,0 @@ -* Odoo SA -* Savoir-faire Linux -* Gervais Naoussi -* Maxime Chambreuil -* Iván Todorovich - -* `Tecnativa `_: - - * Victor M.M. Torres - * Víctor Martínez - -* `Guadaltech `_: - - * Fernando La Chica diff --git a/document_page_approval/readme/DESCRIPTION.md b/document_page_approval/readme/DESCRIPTION.md new file mode 100644 index 00000000..154339b8 --- /dev/null +++ b/document_page_approval/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module adds a workflow to approve page modifications and show the +approved version by default. diff --git a/document_page_approval/readme/DESCRIPTION.rst b/document_page_approval/readme/DESCRIPTION.rst deleted file mode 100644 index be1ab22e..00000000 --- a/document_page_approval/readme/DESCRIPTION.rst +++ /dev/null @@ -1,2 +0,0 @@ -This module adds a workflow to approve page modifications -and show the approved version by default. diff --git a/document_page_approval/readme/USAGE.md b/document_page_approval/readme/USAGE.md new file mode 100644 index 00000000..6c0e11b3 --- /dev/null +++ b/document_page_approval/readme/USAGE.md @@ -0,0 +1,8 @@ +To use this module, you need to: + +1. Go to Knowledge \> Pages +2. Create a new page and choose the previously created category. +3. A notification is sent to the approvers group with a link to the + page history to review. +4. Depending on the review, the page history is approved or not. +5. Users reading the page see the last approved version. diff --git a/document_page_approval/readme/USAGE.rst b/document_page_approval/readme/USAGE.rst deleted file mode 100644 index 6fb71147..00000000 --- a/document_page_approval/readme/USAGE.rst +++ /dev/null @@ -1,8 +0,0 @@ -To use this module, you need to: - -#. Go to Knowledge > Pages -#. Create a new page and choose the previously created category. -#. 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. diff --git a/document_page_approval/static/description/index.html b/document_page_approval/static/description/index.html index 4476c368..ed0b7d3f 100644 --- a/document_page_approval/static/description/index.html +++ b/document_page_approval/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code { margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.option { span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -368,9 +369,9 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:eaa85b29d79372636ce9dda9fbf87f567e6702f38a57385384a168b28a517ff5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/knowledge Translate me on Weblate Try me on Runboat

-

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

+

Beta License: AGPL-3 OCA/knowledge Translate me on Weblate Try me on Runboat

+

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

Table of contents

    @@ -391,8 +392,8 @@ and show the approved version by default.

    1. Set a valid email address on the company settings.
    2. Go to Knowledge > Categories.
    3. -
    4. Create a new page category and set an approver group. -Make sure users belonging to that group have valid email addresses.
    5. +
    6. Create a new page category and set an approver group. Make sure users +belonging to that group have valid email addresses.
@@ -401,8 +402,8 @@ Make sure users belonging to that group have valid email addresses.
  1. Go to Knowledge > Pages
  2. Create a new page and choose the previously created category.
  3. -
  4. A notification is sent to the approvers group with a link to the -page history to review.
  5. +
  6. A notification is sent to the approvers group with a link to the page +history to review.
  7. Depending on the review, the page history is approved or not.
  8. Users reading the page see the last approved version.
@@ -412,7 +413,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 to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -454,11 +455,13 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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/views/document_page_approval.xml b/document_page_approval/views/document_page_approval.xml index 5445e490..4451403e 100644 --- a/document_page_approval/views/document_page_approval.xml +++ b/document_page_approval/views/document_page_approval.xml @@ -14,7 +14,7 @@ type="object" string="Send to Review" class="oe_highlight" - attrs="{'invisible':['|','|',('is_approval_required','=',False),('am_i_owner','=',False),('state', 'not in', ['draft'])]}" + invisible="not is_approval_required or not am_i_owner or state != 'draft'" />