diff --git a/README.md b/README.md index e289b3b31c3..44a6c1bfe97 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ addon | version | maintainers | summary [document_page](document_page/) | 18.0.2.1.0 | | Document Page [document_page_access_group](document_page_access_group/) | 18.0.1.0.1 | | Choose groups to access document pages [document_page_access_group_user_role](document_page_access_group_user_role/) | 18.0.1.0.0 | victoralmau | Document Page Access Group User Role -[document_page_approval](document_page_approval/) | 18.0.1.1.0 | | Document Page Approval +[document_page_approval](document_page_approval/) | 18.0.1.1.1 | | Document Page Approval [document_page_group](document_page_group/) | 18.0.1.0.0 | | Define access groups on documents [document_page_partner](document_page_partner/) | 18.0.1.0.0 | | Allows to link doucment pages to a partner [document_page_project](document_page_project/) | 18.0.1.0.0 | LoisRForgeFlow | This module links document pages to projects diff --git a/document_page_approval/README.rst b/document_page_approval/README.rst index fd540f541fd..73db242b581 100644 --- a/document_page_approval/README.rst +++ b/document_page_approval/README.rst @@ -11,7 +11,7 @@ Document Page Approval !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:ad1f0f3942df59076ffe4ebdf9ba440842d2792c5a1932cfd434ce9f20448e87 + !! source digest: sha256:076e3494c42033cf34cf3d9a7a92ea7f0d7982d04738360bec6ff9604ee1b357 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/document_page_approval/__manifest__.py b/document_page_approval/__manifest__.py index 443af86f0d6..919a398d285 100644 --- a/document_page_approval/__manifest__.py +++ b/document_page_approval/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Document Page Approval", - "version": "18.0.1.1.0", + "version": "18.0.1.1.1", "author": "Savoir-faire Linux, Odoo Community Association (OCA)", "website": "https://github.com/OCA/knowledge", "license": "AGPL-3", diff --git a/document_page_approval/models/document_page_history.py b/document_page_approval/models/document_page_history.py index 085fb59190e..af7558813f4 100644 --- a/document_page_approval/models/document_page_history.py +++ b/document_page_approval/models/document_page_history.py @@ -4,6 +4,7 @@ from odoo import fields, models from odoo.exceptions import UserError +from odoo.tools.misc import clean_context from odoo.tools.translate import _ @@ -80,7 +81,10 @@ def action_to_approve(self): [("groups_id", "in", guids), ("groups_id", "in", approver_gid.id)] ) rec.message_subscribe(partner_ids=users.mapped("partner_id").ids) - rec.message_post_with_source(template) + # pylint: disable=W8121 + rec.with_context( + clean_context(self.env.context) + ).message_post_with_source(template) else: # auto-approve if approval is not required rec.action_approve() diff --git a/document_page_approval/static/description/index.html b/document_page_approval/static/description/index.html index eeccf633d05..a6f9022073c 100644 --- a/document_page_approval/static/description/index.html +++ b/document_page_approval/static/description/index.html @@ -372,7 +372,7 @@

Document Page Approval

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:ad1f0f3942df59076ffe4ebdf9ba440842d2792c5a1932cfd434ce9f20448e87 +!! source digest: sha256:076e3494c42033cf34cf3d9a7a92ea7f0d7982d04738360bec6ff9604ee1b357 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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 diff --git a/document_page_approval/tests/test_document_page_approval.py b/document_page_approval/tests/test_document_page_approval.py index 01a00a73505..de41f27da76 100644 --- a/document_page_approval/tests/test_document_page_approval.py +++ b/document_page_approval/tests/test_document_page_approval.py @@ -1,6 +1,7 @@ from odoo import Command from odoo.exceptions import UserError from odoo.tests import new_test_user +from odoo.tools import mute_logger from odoo.addons.base.tests.common import BaseCommon @@ -53,6 +54,7 @@ def test_approval_required(self): self.assertTrue(page.has_changes_pending_approval) self.assertEqual(len(page.history_ids), 0) + @mute_logger("odoo.models.unlink") def test_change_request_approve(self): """Test that an approver can approve a change request.""" page = self.page2 @@ -72,6 +74,11 @@ def test_change_request_approve(self): self.assertEqual(chreq.state, "approved") self.assertEqual(chreq.content, page.content) + # Remove the linked mail.message and define a specific context to simulate that + # when accessing from the category smart button, there is no error when creating + # the history and sending the email + self.env["mail.message"].browse(page.parent_id.id).unlink() + page = page.with_context(default_parent_id=page.parent_id.id) # Create new change request page.write({"content": "

New content

"}) page.invalidate_model() # Recompute fields @@ -90,6 +97,7 @@ def test_change_request_auto_approve(self): page.write({"content": "

New content

"}) self.assertEqual(page.content, "

New content

") + @mute_logger("odoo.models.unlink") def test_change_request_from_scratch(self): """Test a full change request lifecycle from draft to approval.""" page = self.page2 @@ -164,6 +172,7 @@ def test_can_user_approve_this_page(self): self.page2.with_user(self.user2).can_user_approve_this_page(self.user2) ) + @mute_logger("odoo.models.unlink") def test_pending_approval_detection(self): """Ensure the system detects pending approval changes""" # Reset page2 by removing previous history