Compare commits

...

2 Commits

Author SHA1 Message Date
Aaron Bohy
9634e6eebb [REM] reference/user_interface: remove banner_route
This commit removes the documentation about the banner_route view
attribute, which has been dropped in odoo/odoo#177244.

Task~4126004
2024-08-23 08:30:14 +02:00
Aaron Bohy
924d273f50 [IMP] reference/user_interface: adapt list width attr doc
This commit rewrittes the documentation of the `width` attribute
in list views, following recent changes [1]

[1] odoo/odoo#170511
2024-07-11 17:12:14 +02:00
2 changed files with 9 additions and 55 deletions

View File

@@ -113,8 +113,6 @@ Optional attributes can be added to the root element `form` to customize the vie
:type: bool
:default: `False`
.. include:: view_architectures/root_attribute_banner_route.rst
.. _reference/view_architectures/form/semantic:
Semantic components
@@ -1299,8 +1297,6 @@ Optional attributes can be added to the root element `tree` to customize the vie
.. include:: view_architectures/root_attribute_sample.rst
.. include:: view_architectures/root_attribute_banner_route.rst
.. _reference/view_architectures/list/components:
Components
@@ -1415,11 +1411,15 @@ The `field` element can have the following attributes:
.. attribute:: width
:noindex:
The width to apply to the field's column when there are no records in the list, as an absolute
width (e.g., `100px`).
.. important::
The width is set by the webclient when there are records in the list.
The list view always tries to optimize the available space among columns. For some field types,
this is done by enforcing a width, depending on the field type. For instance, we know exactly the
number of pixels required to display a date, so we can ensure that a column for a date field
doesn't take more space than what is strictly necessary, thus leaving the extra space for the
other columns. However, the framework can't guess the adequate width for every field types. For
instance, char fields can be used to encode large values, or 3-letter country codes. In the
latter case, one can set the width directly in the arch (e.g. `width="40px"`). It represents
the width (always in pixels) required to render the values inside the cells. The width of the
column will then be the sum of the given value and the cells' left and right paddings.
:requirement: Optional
:type: str
@@ -2505,8 +2505,6 @@ Optional attributes can be added to the root element `kanban` to customize the v
.. include:: view_architectures/root_attribute_sample.rst
.. include:: view_architectures/root_attribute_banner_route.rst
.. _reference/view_architectures/kanban/components:
Components

View File

@@ -1,44 +0,0 @@
.. attribute:: banner_route
:noindex:
The route to fetch HTML from and prepend it to the view.
If this attribute is set, the URL of the :ref:`controller route <reference/controllers>` is
fetched and the returned content is displayed above the view. The JSON response from the
controller must contain an `html` key.
If the HTML contains a `<link>` tag for a stylesheet, it is removed from its original location
and appended to the `<head>` section.
To interact with the backend, use `<a type="action">` tags. For more details, refer to the
documentation of the `_onActionClicked` method in `AbstractController
<{GITHUB_PATH}/addons/web/static/src/js/views/abstract_controller.js>`_.
Only views extending `AbstractView` and `AbstractController`, such as
:ref:`reference/view_architectures/form`, :ref:`reference/view_architectures/kanban`, and
:ref:`reference/view_architectures/list`, can use this attribute.
.. example::
.. code-block:: xml
<tree banner_route="/module_name/hello" />
.. code-block:: python
class MyController(odoo.http.Controller):
@http.route('/module_name/hello', auth='user', type='json')
def hello(self):
return {
'html': """
<div>
<link href="/module_name/static/src/css/banner.css"
rel="stylesheet">
<h1>hello, world</h1>
</div> """
}
:requirement: Optional
:type: path_
:default: `''`
.. _`path`: https://en.wikipedia.org/wiki/Path_(computing)