Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
116 changes: 65 additions & 51 deletions cms_info/README.rst
Original file line number Diff line number Diff line change
@@ -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
========
Expand All @@ -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**

Expand All @@ -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 <https://github.com/OCA/website-cms/issues/127>`_)

- 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>`_)

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

Expand All @@ -126,25 +132,25 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/website-cms/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 <https://github.com/OCA/website-cms/issues/new?body=module:%20cms_info%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/website-cms/issues/new?body=module:%20cms_info%0Aversion:%2019.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.

Credits
=======

Authors
~~~~~~~
-------

* Camptocamp

Contributors
~~~~~~~~~~~~
------------

* Simone Orsi <simone.orsi@camptocamp.com>
- Simone Orsi <simone.orsi@camptocamp.com>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -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 <https://github.com/OCA/website-cms/tree/16.0/cms_info>`_ project on GitHub.
.. |maintainer-simahawk| image:: https://github.com/simahawk.png?size=40px
:target: https://github.com/simahawk
:alt: simahawk

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-simahawk|

This module is part of the `OCA/website-cms <https://github.com/OCA/website-cms/tree/19.0/cms_info>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 3 additions & 3 deletions cms_info/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
}
6 changes: 3 additions & 3 deletions cms_info/models/cms_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions cms_info/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Simone Orsi \<<simone.orsi@camptocamp.com>\>
1 change: 0 additions & 1 deletion cms_info/readme/CONTRIBUTORS.rst

This file was deleted.

3 changes: 3 additions & 0 deletions cms_info/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 0 additions & 2 deletions cms_info/readme/DESCRIPTION.rst

This file was deleted.

26 changes: 26 additions & 0 deletions cms_info/readme/HISTORY.md
Original file line number Diff line number Diff line change
@@ -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
31 changes: 0 additions & 31 deletions cms_info/readme/HISTORY.rst

This file was deleted.

2 changes: 2 additions & 0 deletions cms_info/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Get rid of website dependency and move website.published.mixin
integration to a glue module.
3 changes: 0 additions & 3 deletions cms_info/readme/ROADMAP.rst

This file was deleted.

37 changes: 37 additions & 0 deletions cms_info/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading