diff --git a/web_widget_char_size/README.rst b/web_widget_char_size/README.rst index 097e5f303..60300c5fa 100644 --- a/web_widget_char_size/README.rst +++ b/web_widget_char_size/README.rst @@ -17,13 +17,13 @@ Widget Char size :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github - :target: https://github.com/OCA/web/tree/15.0/web_widget_char_size + :target: https://github.com/OCA/web/tree/16.0/web_widget_char_size :alt: OCA/web .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_widget_char_size + :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_widget_char_size :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/web&target_branch=15.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -36,9 +36,7 @@ This module allows to add an option `size` to Char fields in web client: that allows to enter only the specified number of characters in the field. -Note that adding the `size=` attribute in Char field definition raises the following warning: - - unknown parameter 'size', if this is an actual parameter you may want to override the method _valid_field_parameter on the relevant model in order to allow it +Adding "size" as a parameter while defining Char field is deprecated officially. **Table of contents** @@ -51,7 +49,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. @@ -76,6 +74,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/web `_ project on GitHub. +This module is part of the `OCA/web `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_widget_char_size/__manifest__.py b/web_widget_char_size/__manifest__.py index d779de2a1..733881572 100644 --- a/web_widget_char_size/__manifest__.py +++ b/web_widget_char_size/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Widget Char size", "summary": "Add size option to Char widget", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "category": "Hidden", "website": "https://github.com/OCA/web", "author": "Agile Business Group, Odoo Community Association (OCA)", @@ -12,6 +12,6 @@ "web", ], "assets": { - "web.assets_backend": ["web_widget_char_size/static/src/js/char_widget.js"] + "web.assets_backend": ["web_widget_char_size/static/src/js/char_widget.esm.js"] }, } diff --git a/web_widget_char_size/readme/DESCRIPTION.rst b/web_widget_char_size/readme/DESCRIPTION.rst index afdfd0a79..da36dabac 100644 --- a/web_widget_char_size/readme/DESCRIPTION.rst +++ b/web_widget_char_size/readme/DESCRIPTION.rst @@ -6,6 +6,4 @@ This module allows to add an option `size` to Char fields in web client: that allows to enter only the specified number of characters in the field. -Note that adding the `size=` attribute in Char field definition raises the following warning: - - unknown parameter 'size', if this is an actual parameter you may want to override the method _valid_field_parameter on the relevant model in order to allow it +Adding "size" as a parameter while defining Char field is deprecated officially. diff --git a/web_widget_char_size/static/description/index.html b/web_widget_char_size/static/description/index.html index 283fa57ea..c0d76e0d9 100644 --- a/web_widget_char_size/static/description/index.html +++ b/web_widget_char_size/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,15 +369,13 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:5f94ad897a05e212eec3660aad1c9ae9d08a2ac7098917e2a0cb74868de392d1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This module allows to add an option size to Char fields in web client:

 <field name="sized_5_field" options="{'size': 5}"/>
 

that allows to enter only the specified number of characters in the field.

-

Note that adding the size= attribute in Char field definition raises the following warning:

-
-unknown parameter ‘size’, if this is an actual parameter you may want to override the method _valid_field_parameter on the relevant model in order to allow it
+

Adding “size” as a parameter while defining Char field is deprecated officially.

Table of contents

    @@ -393,7 +392,7 @@ unknown parameter ‘size’, if this is an actual parameter you may want to ove

    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.

@@ -407,11 +406,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/web project on GitHub.

+

This module is part of the OCA/web project on GitHub.

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

diff --git a/web_widget_char_size/static/src/js/char_widget.esm.js b/web_widget_char_size/static/src/js/char_widget.esm.js new file mode 100644 index 000000000..ae98f8196 --- /dev/null +++ b/web_widget_char_size/static/src/js/char_widget.esm.js @@ -0,0 +1,10 @@ +/** @odoo-module **/ + +import {CharField} from "@web/views/fields/char/char_field"; + +const _extractProps = CharField.extractProps; +CharField.extractProps = ({attrs, field}) => { + return Object.assign(_extractProps({attrs, field}), { + maxLength: field.size || attrs.options.size, + }); +}; diff --git a/web_widget_char_size/static/src/js/char_widget.js b/web_widget_char_size/static/src/js/char_widget.js deleted file mode 100644 index 9315f3ecc..000000000 --- a/web_widget_char_size/static/src/js/char_widget.js +++ /dev/null @@ -1,16 +0,0 @@ -odoo.define("web_widget_char_size.char_widget", function (require) { - "use strict"; - - var BasicFields = require("web.basic_fields"); - - BasicFields.FieldChar.include({ - _renderEdit: function () { - var def = this._super.apply(this, arguments); - var option_size = this.nodeOptions.size; - if (option_size && option_size > 0) { - this.$el.attr("maxlength", option_size); - } - return def; - }, - }); -});