diff --git a/web_widget_dropdown_dynamic/README.rst b/web_widget_dropdown_dynamic/README.rst index 81fbf2be5..b39a4cc00 100644 --- a/web_widget_dropdown_dynamic/README.rst +++ b/web_widget_dropdown_dynamic/README.rst @@ -17,22 +17,22 @@ Dynamic Dropdown Widget :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/17.0/web_widget_dropdown_dynamic + :target: https://github.com/OCA/web/tree/18.0/web_widget_dropdown_dynamic :alt: OCA/web .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_widget_dropdown_dynamic + :target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_dropdown_dynamic :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=17.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| Dynamic dropdown widget that supports resolving options from backend of: - - ``fields.Char`` - - ``fields.Integer`` - - ``fields.Selection`` + - ``fields.Char`` + - ``fields.Integer`` + - ``fields.Selection`` **NOTE:** This widget is not intended to *extend* ``fields.Selection``, but to filter selection values. For fully-dynamic set of options, use @@ -84,7 +84,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. @@ -99,23 +99,25 @@ Authors Contributors ------------ -- `CorporateHub `__ +- `CorporateHub `__ - - Alexey Pelykh + - Alexey Pelykh -- `Therp BV `__ +- `Therp BV `__ - - Ronald Portier + - Ronald Portier -- Thanakrit Pintana +- Thanakrit Pintana -- `Trobz `__: +- `Trobz `__: - - Son Ho + - Son Ho -- `Tecnativa `__: +- `Tecnativa `__: - - Carlos Roca + - Carlos Roca + +- ``Heliconia Solutions Pvt. Ltd. ``\ \_ Other credits ------------- @@ -136,6 +138,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_dropdown_dynamic/__manifest__.py b/web_widget_dropdown_dynamic/__manifest__.py index 12e1fe6a4..9aa7c6149 100644 --- a/web_widget_dropdown_dynamic/__manifest__.py +++ b/web_widget_dropdown_dynamic/__manifest__.py @@ -5,7 +5,7 @@ "name": "Dynamic Dropdown Widget", "summary": "This module adds support for dynamic dropdown widget", "category": "Web", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "license": "AGPL-3", "author": "CorporateHub, Odoo Community Association (OCA)", "website": "https://github.com/OCA/web", diff --git a/web_widget_dropdown_dynamic/readme/CONTRIBUTORS.md b/web_widget_dropdown_dynamic/readme/CONTRIBUTORS.md index 510d7f721..49740cb77 100644 --- a/web_widget_dropdown_dynamic/readme/CONTRIBUTORS.md +++ b/web_widget_dropdown_dynamic/readme/CONTRIBUTORS.md @@ -13,4 +13,5 @@ > - Son Ho \<\> - [Tecnativa](https://www.tecnativa.com): - - Carlos Roca \ No newline at end of file + - Carlos Roca +- `Heliconia Solutions Pvt. Ltd. `_ diff --git a/web_widget_dropdown_dynamic/static/description/index.html b/web_widget_dropdown_dynamic/static/description/index.html index 86e1c21fb..bc492c3d3 100644 --- a/web_widget_dropdown_dynamic/static/description/index.html +++ b/web_widget_dropdown_dynamic/static/description/index.html @@ -369,7 +369,7 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:cd8f2fbb81d5981346094e7fb21bd25632e10536593177a28be1aca666f715a5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

Dynamic dropdown widget that supports resolving options from backend of:

    @@ -431,7 +431,7 @@ and Two.

    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.

    @@ -469,6 +469,8 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
  • Carlos Roca
+
  • Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>_

    +
  • @@ -485,7 +487,7 @@ by Camptocamp

    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_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js b/web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js index 38752bae5..4e83058f9 100644 --- a/web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js +++ b/web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js @@ -1,8 +1,9 @@ /** @odoo-module **/ -import {_lt} from "@web/core/l10n/translation"; +import {_t} from "@web/core/l10n/translation"; import {registry} from "@web/core/registry"; import {standardFieldProps} from "@web/views/fields/standard_field_props"; import {Component, onWillStart, onWillUpdateProps} from "@odoo/owl"; +import {useOwnedDialogs} from "@web/core/utils/hooks"; export class FieldDynamicDropdown extends Component { static template = "web.SelectionField"; @@ -12,6 +13,8 @@ export class FieldDynamicDropdown extends Component { context: {type: Object}, }; setup() { + super.setup(); + this.dialogs = useOwnedDialogs(); this.type = this.props.record.fields[this.props.name].type; onWillStart(async () => { this.specialData = await this._fetchSpecialData(this.props); @@ -34,8 +37,8 @@ export class FieldDynamicDropdown extends Component { return specialDataCaches[key]; } get options() { - var field_type = this.type || ""; - if (["char", "integer", "selection"].includes(field_type)) { + const fieldType = this.type || ""; + if (["char", "integer", "selection"].includes(fieldType)) { if ( this.props.record.data[this.props.name] && !this.specialData @@ -58,8 +61,8 @@ export class FieldDynamicDropdown extends Component { * @param {Event} ev */ onChange(ev) { - var isInvalid = false; - var value = JSON.parse(ev.target.value); + let isInvalid = false; + let value = JSON.parse(ev.target.value); if (this.type === "integer") { value = Number(value); if (!value) { @@ -79,11 +82,11 @@ export class FieldDynamicDropdown extends Component { } export const dynamicDropdownField = { component: FieldDynamicDropdown, - displayName: _lt("Dynamic Dropdown"), + displayName: _t("Dynamic Dropdown"), supportedTypes: ["char", "integer", "selection"], - extractProps: (fieldInfo, dynamicInfo) => ({ - method: fieldInfo.options?.values, - context: dynamicInfo.context, + extractProps: ({options}, {context}) => ({ + method: options?.values, + context, }), }; registry.category("fields").add("dynamic_dropdown", dynamicDropdownField); diff --git a/web_widget_dropdown_dynamic/static/tests/web_widget_dropdown_dynamic_tests.esm.js b/web_widget_dropdown_dynamic/static/tests/web_widget_dropdown_dynamic_tests.esm.js index b8b258025..8ae66f52e 100644 --- a/web_widget_dropdown_dynamic/static/tests/web_widget_dropdown_dynamic_tests.esm.js +++ b/web_widget_dropdown_dynamic/static/tests/web_widget_dropdown_dynamic_tests.esm.js @@ -2,7 +2,7 @@ import {editInput, getFixture} from "@web/../tests/helpers/utils"; import {makeView, setupViewRegistries} from "@web/../tests/views/helpers"; -const {QUnit} = window; +import {QUnit} from "@web/static/lib/qunit/qunit"; let serverData = {}; let target = getFixture(); @@ -93,8 +93,6 @@ QUnit.module("web_widget_dropdown_dynamic", (hooks) => { }); QUnit.test("values are fetched w/o context (char)", async (assert) => { assert.expect(6); - console.log("Start assert", serverData); - console.log("Start makeView"); await makeView({ type: "form", resModel: "sale.order", @@ -122,8 +120,6 @@ QUnit.module("web_widget_dropdown_dynamic", (hooks) => { "option[value='\"value b\"']", "got `value b` " ); - - console.log("Ending makeView", target); }); QUnit.test("values are fetched w/o context (integer)", async (assert) => {