From 0859e3572bcac44d1e6733e6cd4002d048e589ba Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Tue, 20 Oct 2026 09:55:18 +0200 Subject: [PATCH 1/4] [IMP] cms_info: pre-commit auto fixes --- cms_info/models/cms_mixin.py | 6 +- cms_info/static/description/index.html | 1296 +++++++++++++++--------- cms_info/tests/test_info_mixin.py | 21 +- 3 files changed, 827 insertions(+), 496 deletions(-) diff --git a/cms_info/models/cms_mixin.py b/cms_info/models/cms_mixin.py index e0bc97ce3..d0619b4c4 100644 --- a/cms_info/models/cms_mixin.py +++ b/cms_info/models/cms_mixin.py @@ -10,7 +10,7 @@ class CMSInfoMixin(models.AbstractModel): _description = "CMS Info mixin" def _cms_make_url(self, action): - return "/cms/{}/{}".format(action, self._name) + return f"/cms/{action}/{self._name}" @property def cms_create_url(self): @@ -82,8 +82,8 @@ def _get_cms_copy_url(self): def _get_cms_delete_urls(self): base_url = self.cms_delete_url_base return { - "cms_delete_url": "{}/{}".format(base_url, self.id), - "cms_delete_confirm_url": "{}/{}/confirm".format(base_url, self.id), + "cms_delete_url": f"{base_url}/{self.id}", + "cms_delete_confirm_url": f"{base_url}/{self.id}/confirm", } def cms_is_owner(self, uid=None): diff --git a/cms_info/static/description/index.html b/cms_info/static/description/index.html index a3ed3ac1e..e5bb9ce1e 100644 --- a/cms_info/static/description/index.html +++ b/cms_info/static/description/index.html @@ -1,13 +1,12 @@ - - - -CMS info - - - -
-

CMS info

- - -

Beta License: LGPL-3 OCA/website-cms Translate me on Weblate Try me on Runboat

-

Provide basic information for website records / models via website.published.mixin. -This module is meant to be used as a base to build your own CMS.

-

Table of contents

- -
-

Usage

-
-

New attributes

-
    -
  • cms_create_url: lead to create view. By default /cms/create/my.model
  • -
  • cms_search_url: lead to search view. By default /cms/search/my.model
  • -
  • cms_edit_url (computed field): lead to edit view. By default /cms/edit/my.model/model_id
  • -
-
-

Note

-

No routing provided. -This attributes provide only basic information on contents’ URLs. -If you use cms_form default routes are handled automatically. -If not, is up to you to provide your own routes to handle them.

-
-
-
-

Permission and extra information

-
    -
  • record.cms_is_owner(): current user is the owner of the record?
  • -
  • record.cms_can_edit(): current user can edit this record?
  • -
  • record.cms_can_publish(): current user can publish this record?
  • -
  • record.cms_can_delete(): current user can delete this record?
  • -
  • model.cms_can_create(): current user can create a new record?
  • -
-
-
-

Info all in one

-

When you build CMS UIs you need all those info at once. -This module provides also an helper method cms_info() -that gives you back a dictionary containing:

-
    -
  • is_owner: True/False,
  • -
  • can_edit: True/False,
  • -
  • can_create: True/False,
  • -
  • can_publish: True/False,
  • -
  • can_delete: True/False,
  • -
  • create_url
  • -
  • edit_url
  • -
  • delete_url
  • -
-
-
-
-

Known issues / Roadmap

-

Get rid of website dependency and move website.published.mixin integration -to a glue module.

-
-
-

Changelog

-
-

16.0.1.0.0 (2023-05-13)

-

Features

-
    -
  • Migration to v16 (#127)
  • -
-
-
-

13.0.1.0.1 (2021-08-23)

-

Features

-
    -
  • Migration to v13 (#111)
  • -
-
-
-

11.0.1.0.1 (2019-01-18)

-

Fixes

-
    -
  • Info dict default to None values
  • -
  • Test coverage 100%
  • -
-
-
-

11.0.1.0.0 (2018-04-27)

-

Improvements

-
    -
  • Initial release
  • -
-
-
-
-

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.

-

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

-
-
-

Credits

-
-

Authors

-
    -
  • Camptocamp
  • -
-
- -
-

Maintainers

-

This module is maintained by the OCA.

-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/website-cms project on GitHub.

-

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

-
-
-
- +

+ Beta + License: LGPL-3 + OCA/website-cms + Translate me on Weblate + Try me on Runboat +

+

+ Provide basic information for website records / models via + website.published.mixin. This module is meant to be used as a base + to build your own CMS. +

+

Table of contents

+
+ +
+
+

Usage

+
+

New attributes

+
    +
  • + cms_create_url: lead to create view. By + default /cms/create/my.model +
  • +
  • + cms_search_url: lead to search view. By + default /cms/search/my.model +
  • +
  • + cms_edit_url (computed field): lead to + edit view. By default + /cms/edit/my.model/model_id +
  • +
+
+

Note

+

+ No routing provided. This attributes provide only basic information on + contents’ URLs. If you use cms_form default routes are + handled automatically. If not, is up to you to provide your own routes to + handle them. +

+
+
+
+

+ Permission and extra information +

+
    +
  • + record.cms_is_owner(): current user is + the owner of the record? +
  • +
  • + record.cms_can_edit(): current user can + edit this record? +
  • +
  • + record.cms_can_publish(): current user + can publish this record? +
  • +
  • + record.cms_can_delete(): current user + can delete this record? +
  • +
  • + model.cms_can_create(): current user can + create a new record? +
  • +
+
+
+

Info all in one

+

+ When you build CMS UIs you need all those info at once. This module provides + also an helper method cms_info() that gives you back a + dictionary containing: +

+
    +
  • is_owner: True/False,
  • +
  • can_edit: True/False,
  • +
  • can_create: True/False,
  • +
  • can_publish: True/False,
  • +
  • can_delete: True/False,
  • +
  • create_url
  • +
  • edit_url
  • +
  • delete_url
  • +
+
+
+
+

Known issues / Roadmap

+

+ Get rid of website dependency and move + website.published.mixin integration to a glue module. +

+
+
+

Changelog

+
+

+ 16.0.1.0.0 (2023-05-13) +

+

Features

+
    +
  • + Migration to v16 (#127) +
  • +
+
+
+

+ 13.0.1.0.1 (2021-08-23) +

+

Features

+
    +
  • + Migration to v13 (#111) +
  • +
+
+
+

+ 11.0.1.0.1 (2019-01-18) +

+

Fixes

+
    +
  • Info dict default to None values
  • +
  • Test coverage 100%
  • +
+
+
+

+ 11.0.1.0.0 (2018-04-27) +

+

Improvements

+
    +
  • Initial release
  • +
+
+
+
+

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. +

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ 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/website-cms + project on GitHub. +

+

+ You are welcome to contribute. To learn how please visit + https://odoo-community.org/page/Contribute. +

+
+
+ + diff --git a/cms_info/tests/test_info_mixin.py b/cms_info/tests/test_info_mixin.py index 146e988cb..f8545b839 100644 --- a/cms_info/tests/test_info_mixin.py +++ b/cms_info/tests/test_info_mixin.py @@ -87,9 +87,10 @@ def test_can_create(self): def _test_can(self, record, mode, handler): path_rights = "odoo.models.Model.check_access_rights" path_rule = "odoo.models.Model.check_access_rule" - with mock.patch(path_rights) as mocked_rights, mock.patch( - path_rule - ) as mocked_rule: + with ( + mock.patch(path_rights) as mocked_rights, + mock.patch(path_rule) as mocked_rule, + ): # test false mocked_rights.side_effect = exceptions.AccessError("BAM!") mocked_rule.side_effect = exceptions.AccessError("BAM!") @@ -98,9 +99,10 @@ def _test_can(self, record, mode, handler): # failed on ACL check, no call here mocked_rule.assert_not_called() - with mock.patch(path_rights) as mocked_rights, mock.patch( - path_rule - ) as mocked_rule: + with ( + mock.patch(path_rights) as mocked_rights, + mock.patch(path_rule) as mocked_rule, + ): # test true only rights mocked_rights.return_value = True mocked_rule.side_effect = exceptions.AccessError("BAM!") @@ -108,9 +110,10 @@ def _test_can(self, record, mode, handler): mocked_rights.assert_called_with(mode) mocked_rule.assert_called_with(mode) - with mock.patch(path_rights) as mocked_rights, mock.patch( - path_rule - ) as mocked_rule: + with ( + mock.patch(path_rights) as mocked_rights, + mock.patch(path_rule) as mocked_rule, + ): # test true mocked_rights.return_value = True mocked_rule.return_value = True From fac7edf32565915e063183daace282eb26709cb5 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Mon, 19 Oct 2026 16:44:42 +0200 Subject: [PATCH 2/4] [MIG] cms_info: Migration to 19.0 - Bump version to 19.0.1.0.0 and fix `mainainers` typo in manifest - Remove XML declaration from static/description/index.html (rejected by Odoo 19 description parser) - Replace odoo_test_helper FakeModelLoader with native registry registration (add_to_registry) --- cms_info/README.rst | 116 +++-- cms_info/__manifest__.py | 6 +- cms_info/readme/CONTRIBUTORS.md | 1 + cms_info/readme/CONTRIBUTORS.rst | 1 - cms_info/readme/DESCRIPTION.md | 3 + cms_info/readme/DESCRIPTION.rst | 2 - cms_info/readme/HISTORY.md | 26 + cms_info/readme/HISTORY.rst | 31 -- cms_info/readme/ROADMAP.md | 2 + cms_info/readme/ROADMAP.rst | 3 - cms_info/readme/USAGE.md | 37 ++ cms_info/readme/USAGE.rst | 38 -- cms_info/static/description/index.html | 655 +++++++++++++------------ cms_info/tests/test_info_mixin.py | 17 +- 14 files changed, 490 insertions(+), 448 deletions(-) create mode 100644 cms_info/readme/CONTRIBUTORS.md delete mode 100644 cms_info/readme/CONTRIBUTORS.rst create mode 100644 cms_info/readme/DESCRIPTION.md delete mode 100644 cms_info/readme/DESCRIPTION.rst create mode 100644 cms_info/readme/HISTORY.md delete mode 100644 cms_info/readme/HISTORY.rst create mode 100644 cms_info/readme/ROADMAP.md delete mode 100644 cms_info/readme/ROADMAP.rst create mode 100644 cms_info/readme/USAGE.md delete mode 100644 cms_info/readme/USAGE.rst diff --git a/cms_info/README.rst b/cms_info/README.rst index 2117dd623..7a6085e58 100644 --- a/cms_info/README.rst +++ b/cms_info/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + ======== CMS info ======== @@ -13,23 +17,24 @@ CMS info .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite--cms-lightgray.png?logo=github - :target: https://github.com/OCA/website-cms/tree/16.0/cms_info + :target: https://github.com/OCA/website-cms/tree/19.0/cms_info :alt: OCA/website-cms .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/website-cms-16-0/website-cms-16-0-cms_info + :target: https://translation.odoo-community.org/projects/website-cms-19-0/website-cms-19-0-cms_info :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/website-cms&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/website-cms&target_branch=19.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -Provide basic information for website records / models via `website.published.mixin`. -This module is meant to be used as a base to build your own CMS. +Provide basic information for website records / models via +website.published.mixin. This module is meant to be used as a base to +build your own CMS. **Table of contents** @@ -40,81 +45,82 @@ Usage ===== New attributes -~~~~~~~~~~~~~~ +-------------- -* ``cms_create_url``: lead to create view. By default ``/cms/create/my.model`` -* ``cms_search_url``: lead to search view. By default ``/cms/search/my.model`` -* ``cms_edit_url`` (computed field): lead to edit view. By default ``/cms/edit/my.model/model_id`` +- ``cms_create_url``: lead to create view. By default + ``/cms/create/my.model`` +- ``cms_search_url``: lead to search view. By default + ``/cms/search/my.model`` +- ``cms_edit_url`` (computed field): lead to edit view. By default + ``/cms/edit/my.model/model_id`` -.. note:: No routing provided. - This attributes provide only basic information on contents' URLs. - If you use `cms_form` default routes are handled automatically. - If not, is up to you to provide your own routes to handle them. +.. note:: + No routing provided. This attributes provide only basic information + on contents' URLs. If you use cms_form default routes are handled + automatically. If not, is up to you to provide your own routes to + handle them. Permission and extra information -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -* ``record.cms_is_owner()``: current user is the owner of the record? -* ``record.cms_can_edit()``: current user can edit this record? -* ``record.cms_can_publish()``: current user can publish this record? -* ``record.cms_can_delete()``: current user can delete this record? -* ``model.cms_can_create()``: current user can create a new record? +-------------------------------- +- ``record.cms_is_owner()``: current user is the owner of the record? +- ``record.cms_can_edit()``: current user can edit this record? +- ``record.cms_can_publish()``: current user can publish this record? +- ``record.cms_can_delete()``: current user can delete this record? +- ``model.cms_can_create()``: current user can create a new record? Info all in one -~~~~~~~~~~~~~~~ +--------------- -When you build CMS UIs you need all those info at once. -This module provides also an helper method `cms_info()` -that gives you back a dictionary containing: +When you build CMS UIs you need all those info at once. This module +provides also an helper method cms_info() that gives you back a +dictionary containing: -* `is_owner`: True/False, -* `can_edit`: True/False, -* `can_create`: True/False, -* `can_publish`: True/False, -* `can_delete`: True/False, -* `create_url` -* `edit_url` -* `delete_url` +- \`is_owner\`: True/False, +- \`can_edit\`: True/False, +- \`can_create\`: True/False, +- \`can_publish\`: True/False, +- \`can_delete\`: True/False, +- create_url +- edit_url +- delete_url Known issues / Roadmap ====================== - -Get rid of `website` dependency and move `website.published.mixin` integration -to a glue module. +Get rid of website dependency and move website.published.mixin +integration to a glue module. Changelog ========= 16.0.1.0.0 (2023-05-13) -~~~~~~~~~~~~~~~~~~~~~~~ +----------------------- **Features** -- Migration to v16 (`#127 `_) - +- Migration to v16 + (`#127 `__) 13.0.1.0.1 (2021-08-23) -~~~~~~~~~~~~~~~~~~~~~~~ +----------------------- **Features** -- Migration to v13 (`#111 `_) - +- Migration to v13 + (`#111 `__) 11.0.1.0.1 (2019-01-18) -~~~~~~~~~~~~~~~~~~~~~~~ +----------------------- **Fixes** - Info dict default to None values - Test coverage 100% - 11.0.1.0.0 (2018-04-27) -~~~~~~~~~~~~~~~~~~~~~~~ +----------------------- **Improvements** @@ -126,7 +132,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. @@ -134,17 +140,17 @@ Credits ======= Authors -~~~~~~~ +------- * Camptocamp Contributors -~~~~~~~~~~~~ +------------ -* Simone Orsi +- Simone Orsi Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -156,6 +162,14 @@ 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/website-cms `_ project on GitHub. +.. |maintainer-simahawk| image:: https://github.com/simahawk.png?size=40px + :target: https://github.com/simahawk + :alt: simahawk + +Current `maintainer `__: + +|maintainer-simahawk| + +This module is part of the `OCA/website-cms `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/cms_info/__manifest__.py b/cms_info/__manifest__.py index d28dfc6a9..432afa3e7 100644 --- a/cms_info/__manifest__.py +++ b/cms_info/__manifest__.py @@ -6,12 +6,12 @@ "summary": """ A set of basic information needed to expose any kind of record in your CMS. """, - "version": "16.0.1.2.0", + "version": "19.0.1.0.0", "category": "CMS", "website": "https://github.com/OCA/website-cms", "author": "Camptocamp, Odoo Community Association (OCA)", - "mainainers": ["simahawk"], + "maintainers": ["simahawk"], "license": "LGPL-3", - "installable": False, + "installable": True, "depends": ["base"], } diff --git a/cms_info/readme/CONTRIBUTORS.md b/cms_info/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..2b66303ae --- /dev/null +++ b/cms_info/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Simone Orsi \<\> diff --git a/cms_info/readme/CONTRIBUTORS.rst b/cms_info/readme/CONTRIBUTORS.rst deleted file mode 100644 index f1c71bce1..000000000 --- a/cms_info/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1 +0,0 @@ -* Simone Orsi diff --git a/cms_info/readme/DESCRIPTION.md b/cms_info/readme/DESCRIPTION.md new file mode 100644 index 000000000..0a9d2c6ba --- /dev/null +++ b/cms_info/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +Provide basic information for website records / models via +website.published.mixin. This module is meant to be used as a base to +build your own CMS. diff --git a/cms_info/readme/DESCRIPTION.rst b/cms_info/readme/DESCRIPTION.rst deleted file mode 100644 index a7ef6eea3..000000000 --- a/cms_info/readme/DESCRIPTION.rst +++ /dev/null @@ -1,2 +0,0 @@ -Provide basic information for website records / models via `website.published.mixin`. -This module is meant to be used as a base to build your own CMS. diff --git a/cms_info/readme/HISTORY.md b/cms_info/readme/HISTORY.md new file mode 100644 index 000000000..c3ea48557 --- /dev/null +++ b/cms_info/readme/HISTORY.md @@ -0,0 +1,26 @@ +## 16.0.1.0.0 (2023-05-13) + +**Features** + +- Migration to v16 + ([\#127](https://github.com/OCA/website-cms/issues/127)) + +## 13.0.1.0.1 (2021-08-23) + +**Features** + +- Migration to v13 + ([\#111](https://github.com/OCA/website-cms/issues/111)) + +## 11.0.1.0.1 (2019-01-18) + +**Fixes** + +- Info dict default to None values +- Test coverage 100% + +## 11.0.1.0.0 (2018-04-27) + +**Improvements** + +- Initial release diff --git a/cms_info/readme/HISTORY.rst b/cms_info/readme/HISTORY.rst deleted file mode 100644 index 3c60ca436..000000000 --- a/cms_info/readme/HISTORY.rst +++ /dev/null @@ -1,31 +0,0 @@ -16.0.1.0.0 (2023-05-13) -~~~~~~~~~~~~~~~~~~~~~~~ - -**Features** - -- Migration to v16 (`#127 `_) - - -13.0.1.0.1 (2021-08-23) -~~~~~~~~~~~~~~~~~~~~~~~ - -**Features** - -- Migration to v13 (`#111 `_) - - -11.0.1.0.1 (2019-01-18) -~~~~~~~~~~~~~~~~~~~~~~~ - -**Fixes** - -- Info dict default to None values -- Test coverage 100% - - -11.0.1.0.0 (2018-04-27) -~~~~~~~~~~~~~~~~~~~~~~~ - -**Improvements** - -- Initial release diff --git a/cms_info/readme/ROADMAP.md b/cms_info/readme/ROADMAP.md new file mode 100644 index 000000000..b08fa9d82 --- /dev/null +++ b/cms_info/readme/ROADMAP.md @@ -0,0 +1,2 @@ +Get rid of website dependency and move website.published.mixin +integration to a glue module. diff --git a/cms_info/readme/ROADMAP.rst b/cms_info/readme/ROADMAP.rst deleted file mode 100644 index a122bbd7f..000000000 --- a/cms_info/readme/ROADMAP.rst +++ /dev/null @@ -1,3 +0,0 @@ - -Get rid of `website` dependency and move `website.published.mixin` integration -to a glue module. diff --git a/cms_info/readme/USAGE.md b/cms_info/readme/USAGE.md new file mode 100644 index 000000000..82baac427 --- /dev/null +++ b/cms_info/readme/USAGE.md @@ -0,0 +1,37 @@ +## New attributes + +- `cms_create_url`: lead to create view. By default + `/cms/create/my.model` +- `cms_search_url`: lead to search view. By default + `/cms/search/my.model` +- `cms_edit_url` (computed field): lead to edit view. By default + `/cms/edit/my.model/model_id` + +> [!NOTE] +> No routing provided. This attributes provide only basic information on +> contents' URLs. If you use cms_form default routes are handled +> automatically. If not, is up to you to provide your own routes to +> handle them. + +## Permission and extra information + +- `record.cms_is_owner()`: current user is the owner of the record? +- `record.cms_can_edit()`: current user can edit this record? +- `record.cms_can_publish()`: current user can publish this record? +- `record.cms_can_delete()`: current user can delete this record? +- `model.cms_can_create()`: current user can create a new record? + +## Info all in one + +When you build CMS UIs you need all those info at once. This module +provides also an helper method cms_info() that gives you back a +dictionary containing: + +- \`is_owner\`: True/False, +- \`can_edit\`: True/False, +- \`can_create\`: True/False, +- \`can_publish\`: True/False, +- \`can_delete\`: True/False, +- create_url +- edit_url +- delete_url diff --git a/cms_info/readme/USAGE.rst b/cms_info/readme/USAGE.rst deleted file mode 100644 index 60886a0dd..000000000 --- a/cms_info/readme/USAGE.rst +++ /dev/null @@ -1,38 +0,0 @@ -New attributes -~~~~~~~~~~~~~~ - -* ``cms_create_url``: lead to create view. By default ``/cms/create/my.model`` -* ``cms_search_url``: lead to search view. By default ``/cms/search/my.model`` -* ``cms_edit_url`` (computed field): lead to edit view. By default ``/cms/edit/my.model/model_id`` - -.. note:: No routing provided. - This attributes provide only basic information on contents' URLs. - If you use `cms_form` default routes are handled automatically. - If not, is up to you to provide your own routes to handle them. - - -Permission and extra information -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -* ``record.cms_is_owner()``: current user is the owner of the record? -* ``record.cms_can_edit()``: current user can edit this record? -* ``record.cms_can_publish()``: current user can publish this record? -* ``record.cms_can_delete()``: current user can delete this record? -* ``model.cms_can_create()``: current user can create a new record? - - -Info all in one -~~~~~~~~~~~~~~~ - -When you build CMS UIs you need all those info at once. -This module provides also an helper method `cms_info()` -that gives you back a dictionary containing: - -* `is_owner`: True/False, -* `can_edit`: True/False, -* `can_create`: True/False, -* `can_publish`: True/False, -* `can_delete`: True/False, -* `create_url` -* `edit_url` -* `delete_url` diff --git a/cms_info/static/description/index.html b/cms_info/static/description/index.html index e5bb9ce1e..4f63d2924 100644 --- a/cms_info/static/description/index.html +++ b/cms_info/static/description/index.html @@ -1,4 +1,3 @@ - @@ -8,10 +7,11 @@ -
-

CMS info

- - -

- Beta - License: LGPL-3 - OCA/website-cms - Translate me on Weblate - Try me on Runboat -

-

- Provide basic information for website records / models via - website.published.mixin. This module is meant to be used as a base - to build your own CMS. -

-

Table of contents

-
-
-
-

Usage

-
-

New attributes

-
    -
  • - cms_create_url: lead to create view. By - default /cms/create/my.model -
  • -
  • - cms_search_url: lead to search view. By - default /cms/search/my.model -
  • -
  • - cms_edit_url (computed field): lead to - edit view. By default - /cms/edit/my.model/model_id -
  • -
-
-

Note

-

- No routing provided. This attributes provide only basic information on - contents’ URLs. If you use cms_form default routes are - handled automatically. If not, is up to you to provide your own routes to - handle them. +

+
+

Info all in one

+

+ When you build CMS UIs you need all those info at once. This module + provides also an helper method cms_info() that gives you back a dictionary + containing:

+
    +
  • `is_owner`: True/False,
  • +
  • `can_edit`: True/False,
  • +
  • `can_create`: True/False,
  • +
  • `can_publish`: True/False,
  • +
  • `can_delete`: True/False,
  • +
  • create_url
  • +
  • edit_url
  • +
  • delete_url
  • +
-
-

- Permission and extra information -

-
    -
  • - record.cms_is_owner(): current user is - the owner of the record? -
  • -
  • - record.cms_can_edit(): current user can - edit this record? -
  • -
  • - record.cms_can_publish(): current user - can publish this record? -
  • -
  • - record.cms_can_delete(): current user - can delete this record? -
  • -
  • - model.cms_can_create(): current user can - create a new record? -
  • -
-
-
-

Info all in one

+
+

Known issues / Roadmap

- When you build CMS UIs you need all those info at once. This module provides - also an helper method cms_info() that gives you back a - dictionary containing: + Get rid of website dependency and move website.published.mixin integration + to a glue module.

-
    -
  • is_owner: True/False,
  • -
  • can_edit: True/False,
  • -
  • can_create: True/False,
  • -
  • can_publish: True/False,
  • -
  • can_delete: True/False,
  • -
  • create_url
  • -
  • edit_url
  • -
  • delete_url
  • -
-
-
-
-

Known issues / Roadmap

-

- Get rid of website dependency and move - website.published.mixin integration to a glue module. -

-
-
-

Changelog

-
-

- 16.0.1.0.0 (2023-05-13) -

-

Features

-
    -
  • - Migration to v16 (#127) -
  • -
-
-
-

- 13.0.1.0.1 (2021-08-23) -

-

Features

-
    -
  • - Migration to v13 (#111) -
  • -
-
-
-

- 11.0.1.0.1 (2019-01-18) -

-

Fixes

-
    -
  • Info dict default to None values
  • -
  • Test coverage 100%
  • -
-
-
-

- 11.0.1.0.0 (2018-04-27) -

-

Improvements

-
    -
  • Initial release
  • -
-
-
-

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. -

-

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

-
-
-

Credits

-
-

Authors

-
    -
  • Camptocamp
  • -
-
-
-

Contributors

- +
+

Changelog

+
+

+ 16.0.1.0.0 (2023-05-13) +

+

Features

+
    +
  • + Migration to v16 (#127) +
  • +
+
+
+

+ 13.0.1.0.1 (2021-08-23) +

+

Features

+
    +
  • + Migration to v13 (#111) +
  • +
+
+
+

+ 11.0.1.0.1 (2019-01-18) +

+

Fixes

+
    +
  • Info dict default to None values
  • +
  • Test coverage 100%
  • +
+
+
+

+ 11.0.1.0.0 (2018-04-27) +

+

Improvements

+
    +
  • Initial release
  • +
+
-
-

Maintainers

-

This module is maintained by the OCA.

- 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. -

+
+

Bug Tracker

- This module is part of the + Bugs are tracked on OCA/website-cms - project on GitHub. -

-

- You are welcome to contribute. To learn how please visit + href="https://github.com/OCA/website-cms/issues" + >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 https://odoo-community.org/page/Contributefeedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ + 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. +

+

+ Current + maintainer: +

+

+ simahawk +

+

+ This module is part of the + OCA/website-cms + project on GitHub. +

+

+ You are welcome to contribute. To learn how please visit + https://odoo-community.org/page/Contribute. +

+
diff --git a/cms_info/tests/test_info_mixin.py b/cms_info/tests/test_info_mixin.py index f8545b839..c474b120e 100644 --- a/cms_info/tests/test_info_mixin.py +++ b/cms_info/tests/test_info_mixin.py @@ -2,9 +2,8 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) from unittest import mock -from odoo_test_helper import FakeModelLoader - from odoo import exceptions +from odoo.orm.model_classes import add_to_registry from odoo.tests.common import TransactionCase @@ -12,11 +11,14 @@ class TestInfoMixin(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() - cls.loader = FakeModelLoader(cls.env, cls.__module__) - cls.loader.backup_registry() from .fake_models import FakeModel - cls.loader.update_registry((FakeModel,)) + add_to_registry(cls.registry, FakeModel) + cls.registry._setup_models__(cls.env.cr, [FakeModel._name]) + cls.registry.init_models( + cls.env.cr, [FakeModel._name], {"models_to_check": True} + ) + cls.addClassCleanup(cls.registry.__delitem__, FakeModel._name) cls.model = cls.env[FakeModel._name] cls.record = cls.model.create({"name": "Foo"}) user_model = cls.env["res.users"].with_context( @@ -30,11 +32,6 @@ def setUpClass(cls): } ) - @classmethod - def tearDownClass(cls): - cls.loader.restore_registry() - super().tearDownClass() - def test_create_url(self): self.assertEqual(self.record.cms_create_url, "/cms/create/fake.model") From 08774f90a10c8e8f07e9d928f76b2557c968ac1f Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Tue, 20 Oct 2026 10:02:31 +0200 Subject: [PATCH 3/4] [MIG] cms_info: update pre-commit excluded addons --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e5916b183..42661f390 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,6 @@ exclude: | # NOT INSTALLABLE ADDONS ^cms_form/| ^cms_form_example/| - ^cms_info/| ^cms_status_message/| # END NOT INSTALLABLE ADDONS # Files and folders generated by bots, to avoid loops From 747e1940ff45c3bb4e4e2fd6b2de77aca890e2cc Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Tue, 20 Oct 2026 10:07:21 +0200 Subject: [PATCH 4/4] [FIX] cms_info: pre-commit auto fixes post-migration --- cms_info/static/description/index.html | 1349 +++++++++--------------- 1 file changed, 500 insertions(+), 849 deletions(-) diff --git a/cms_info/static/description/index.html b/cms_info/static/description/index.html index 4f63d2924..7fc63ab5d 100644 --- a/cms_info/static/description/index.html +++ b/cms_info/static/description/index.html @@ -1,11 +1,12 @@ - - - - CMS info - - - -
- - Odoo Community Association - -
-

CMS info

- -

- Beta - License: LGPL-3 - OCA/website-cms - Translate me on Weblate - Try me on Runboat -

-

- Provide basic information for website records / models via - website.published.mixin. This module is meant to be used as a base to build - your own CMS. -

-

Table of contents

- -
-

Usage

-
-

New attributes

-
    -
  • - cms_create_url: lead to create view. - By default /cms/create/my.model -
  • -
  • - cms_search_url: lead to search view. - By default /cms/search/my.model -
  • -
  • - cms_edit_url (computed field): lead to - edit view. By default - /cms/edit/my.model/model_id -
  • -
-
-

Note

-

- No routing provided. This attributes provide only basic information on - contents’ URLs. If you use cms_form default routes are handled - automatically. If not, is up to you to provide your own routes to handle - them. -

-
-
-
-

- Permission and extra information -

-
    -
  • - record.cms_is_owner(): current user is - the owner of the record? -
  • -
  • - record.cms_can_edit(): current user - can edit this record? -
  • -
  • - record.cms_can_publish(): current user - can publish this record? -
  • -
  • - record.cms_can_delete(): current user - can delete this record? -
  • -
  • - model.cms_can_create(): current user - can create a new record? -
  • -
-
-
-

Info all in one

-

- When you build CMS UIs you need all those info at once. This module - provides also an helper method cms_info() that gives you back a dictionary - containing: -

-
    -
  • `is_owner`: True/False,
  • -
  • `can_edit`: True/False,
  • -
  • `can_create`: True/False,
  • -
  • `can_publish`: True/False,
  • -
  • `can_delete`: True/False,
  • -
  • create_url
  • -
  • edit_url
  • -
  • delete_url
  • -
-
-
-
-

Known issues / Roadmap

-

- Get rid of website dependency and move website.published.mixin integration - to a glue module. -

-
-
-

Changelog

-
-

- 16.0.1.0.0 (2023-05-13) -

-

Features

-
    -
  • - Migration to v16 (#127) -
  • -
-
-
-

- 13.0.1.0.1 (2021-08-23) -

-

Features

-
    -
  • - Migration to v13 (#111) -
  • -
-
-
-

- 11.0.1.0.1 (2019-01-18) -

-

Fixes

-
    -
  • Info dict default to None values
  • -
  • Test coverage 100%
  • -
-
-
-

- 11.0.1.0.0 (2018-04-27) -

-

Improvements

-
    -
  • Initial release
  • -
-
-
-
-

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. -

-

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

-
-
-

Credits

-
-

Authors

-
    -
  • Camptocamp
  • -
-
-
-

Contributors

- -
-
-

Maintainers

-

This module is maintained by the OCA.

- - 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. -

-

- Current - maintainer: -

-

- simahawk -

-

- This module is part of the - OCA/website-cms - project on GitHub. -

-

- You are welcome to contribute. To learn how please visit - https://odoo-community.org/page/Contribute. -

-
-
-
-
- +

Beta License: LGPL-3 OCA/website-cms Translate me on Weblate Try me on Runboat

+

Provide basic information for website records / models via +website.published.mixin. This module is meant to be used as a base to +build your own CMS.

+

Table of contents

+ +
+

Usage

+
+

New attributes

+
    +
  • cms_create_url: lead to create view. By default +/cms/create/my.model
  • +
  • cms_search_url: lead to search view. By default +/cms/search/my.model
  • +
  • cms_edit_url (computed field): lead to edit view. By default +/cms/edit/my.model/model_id
  • +
+
+

Note

+

No routing provided. This attributes provide only basic information +on contents’ URLs. If you use cms_form default routes are handled +automatically. If not, is up to you to provide your own routes to +handle them.

+
+
+
+

Permission and extra information

+
    +
  • record.cms_is_owner(): current user is the owner of the record?
  • +
  • record.cms_can_edit(): current user can edit this record?
  • +
  • record.cms_can_publish(): current user can publish this record?
  • +
  • record.cms_can_delete(): current user can delete this record?
  • +
  • model.cms_can_create(): current user can create a new record?
  • +
+
+
+

Info all in one

+

When you build CMS UIs you need all those info at once. This module +provides also an helper method cms_info() that gives you back a +dictionary containing:

+
    +
  • `is_owner`: True/False,
  • +
  • `can_edit`: True/False,
  • +
  • `can_create`: True/False,
  • +
  • `can_publish`: True/False,
  • +
  • `can_delete`: True/False,
  • +
  • create_url
  • +
  • edit_url
  • +
  • delete_url
  • +
+
+
+
+

Known issues / Roadmap

+

Get rid of website dependency and move website.published.mixin +integration to a glue module.

+
+
+

Changelog

+
+

16.0.1.0.0 (2023-05-13)

+

Features

+
    +
  • Migration to v16 +(#127)
  • +
+
+
+

13.0.1.0.1 (2021-08-23)

+

Features

+
    +
  • Migration to v13 +(#111)
  • +
+
+
+

11.0.1.0.1 (2019-01-18)

+

Fixes

+
    +
  • Info dict default to None values
  • +
  • Test coverage 100%
  • +
+
+
+

11.0.1.0.0 (2018-04-27)

+

Improvements

+
    +
  • Initial release
  • +
+
+
+
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+ +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.

+

Current maintainer:

+

simahawk

+

This module is part of the OCA/website-cms project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+
+