diff --git a/.copier-answers.yml b/.copier-answers.yml index c88719c15a15..638aa7c9d70e 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,8 +1,7 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.35 +_commit: v1.49 _src_path: git+https://github.com/OCA/oca-addons-repo-template additional_ruff_rules: [] -ci: GitHub convert_readme_fragments_to_markdown: true enable_checklog_odoo: true generate_requirements_txt: true @@ -17,6 +16,7 @@ odoo_test_flavor: Both odoo_version: 19.0 org_name: Odoo Community Association (OCA) org_slug: OCA +postgres_image: '' rebel_module_groups: [] repo_description: web repo_name: web diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index d61380e4fd4b..e3344ab04db5 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,3 +1,4 @@ + name: pre-commit on: @@ -9,17 +10,28 @@ on: - "19.0" - "19.0-ocabot-*" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + jobs: pre-commit: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: - python-version: "3.11" + python-version: "3.12" + cache: 'pip' + cache-dependency-path: '.pre-commit-config.yaml' - name: Get python version run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - - uses: actions/cache@v4 + - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index fa17fcd4e854..3b2e536808d9 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -4,12 +4,17 @@ on: schedule: - cron: "0 12 * * 0" +permissions: + contents: read + issues: write + pull-requests: write + jobs: stale: runs-on: ubuntu-latest steps: - name: Stale PRs and issues policy - uses: actions/stale@v9 + uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} # General settings. @@ -48,7 +53,7 @@ jobs: # * Issues that are pending more information # * Except Issues marked as "no stale" - name: Needs more information stale issues policy - uses: actions/stale@v9 + uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} ascending: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6101a2b02680..b03ad0fc83fc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,12 +9,21 @@ on: - "19.0" - "19.0-ocabot-*" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + jobs: unreleased-deps: runs-on: ubuntu-latest name: Detect unreleased dependencies steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - run: | for reqfile in requirements.txt test-requirements.txt ; do if [ -f ${reqfile} ] ; then @@ -29,7 +38,7 @@ jobs: done test: runs-on: ubuntu-22.04 - container: ${{ matrix.container }} + container: ${{ matrix.container }} # zizmor: ignore[unpinned-images] name: ${{ matrix.name }} strategy: fail-fast: false @@ -50,9 +59,9 @@ jobs: ports: - 5432:5432 env: - OCA_ENABLE_CHECKLOG_ODOO: "1" + "OCA_ENABLE_CHECKLOG_ODOO": "1" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Install addons and dependencies @@ -65,9 +74,19 @@ jobs: run: oca_init_test_database - name: Run tests run: oca_run_tests - - uses: codecov/codecov-action@v4 + - name: Upload screenshots from JS tests + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + if: ${{ failure() }} + with: + name: Screenshots of failed JS tests - ${{ matrix.name }}${{ join(matrix.include) }} + path: /tmp/odoo_tests/${{ env.PGDATABASE }} + if-no-files-found: ignore + - uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: token: ${{ secrets.CODECOV_TOKEN }} - name: Update .pot files - run: oca_export_and_push_pot https://x-access-token:${{ secrets.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }} - if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'OCA' }} + run: oca_export_and_push_pot "https://x-access-token:${GIT_PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}" + env: + GIT_PUSH_TOKEN: ${{ secrets.GIT_PUSH_TOKEN }} + if: matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'OCA' + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a8ff823ce563..34400e5638df 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ exclude: | # You don't usually want a bot to modify your legal texts (LICENSE.*|COPYING.*) default_language_version: - python: python3 + python: python3.12 node: "22.9.0" repos: - repo: local @@ -38,12 +38,17 @@ repos: entry: found a en.po file language: fail files: '[a-zA-Z0-9_]*/i18n/en\.po$' + - id: obsolete dotfiles + name: obsolete dotfiles + entry: found obsolete files; remove them + files: '^(\.travis\.yml|\.t2d\.yml|CONTRIBUTING\.md|\.prettierrc\.yml|\.eslintrc\.yml)$' + language: fail - repo: https://github.com/sbidoul/whool rev: v1.3 hooks: - id: whool-init - repo: https://github.com/oca/maintainer-tools - rev: f9b919b9868143135a9c9cb03021089cabba8223 + rev: b8311a95009805a6e5593f0390f52c0fa350117f hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons @@ -60,7 +65,7 @@ repos: - --convert-fragments-to-markdown - id: oca-gen-external-dependencies - repo: https://github.com/OCA/odoo-pre-commit-hooks - rev: v0.1.6 + rev: v0.1.7 hooks: - id: oca-checks-odoo-module - id: oca-checks-po @@ -123,7 +128,7 @@ repos: args: [--fix, --exit-non-zero-on-fix] - id: ruff-format - repo: https://github.com/OCA/pylint-odoo - rev: v9.3.15 + rev: v10.0.8 hooks: - id: pylint_odoo name: pylint with optional checks diff --git a/.pylintrc b/.pylintrc index f3d017a8f5af..6e7ca6b0a3df 100644 --- a/.pylintrc +++ b/.pylintrc @@ -4,6 +4,9 @@ load-plugins=pylint_odoo score=n +[IMPORTS] +deprecated-modules=pdb,pudb,ipdb,bs4 + [ODOOLINT] readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst" manifest-required-authors=Odoo Community Association (OCA) @@ -26,6 +29,7 @@ enable=anomalous-backslash-in-string, assignment-from-none, attribute-deprecated, dangerous-default-value, + deprecated-module, development-status-allowed, duplicate-key, eval-used, @@ -71,6 +75,7 @@ enable=anomalous-backslash-in-string, category-allowed, deprecated-name-get, deprecated-odoo-model-method, + deprecated-self-cr, inheritable-method-lambda, inheritable-method-string, invalid-email, @@ -85,6 +90,7 @@ enable=anomalous-backslash-in-string, translation-format-interpolation, translation-format-truncated, translation-fstring-interpolation, + translation-injection, translation-not-lazy, translation-too-few-args, translation-too-many-args, @@ -92,20 +98,11 @@ enable=anomalous-backslash-in-string, no-write-in-compute, # messages that do not cause the lint step to fail consider-merging-classes-inherited, - create-user-wo-reset-password, - dangerous-filter-wo-user, deprecated-module, - file-not-used, invalid-commit, - missing-manifest-dependency, - missing-newline-extrafiles, missing-readme, - no-utf8-coding-comment, odoo-addons-relative-import, - old-api7-method-defined, redefined-builtin, - too-complex, - unnecessary-utf8-coding-comment, manifest-external-assets diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index 80567de1e77c..18694fe63041 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -3,6 +3,9 @@ load-plugins=pylint_odoo score=n +[IMPORTS] +deprecated-modules=pdb,pudb,ipdb,bs4 + [ODOOLINT] readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst" manifest-required-authors=Odoo Community Association (OCA) @@ -18,6 +21,7 @@ enable=anomalous-backslash-in-string, assignment-from-none, attribute-deprecated, dangerous-default-value, + deprecated-module, development-status-allowed, duplicate-key, eval-used, @@ -63,6 +67,7 @@ enable=anomalous-backslash-in-string, category-allowed, deprecated-name-get, deprecated-odoo-model-method, + deprecated-self-cr, inheritable-method-lambda, inheritable-method-string, invalid-email, @@ -77,6 +82,7 @@ enable=anomalous-backslash-in-string, translation-format-interpolation, translation-format-truncated, translation-fstring-interpolation, + translation-injection, translation-not-lazy, translation-too-few-args, translation-too-many-args, diff --git a/README.md b/README.md index f616063055f4..2f7ab42d9202 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ +[![Support the OCA](https://odoo-community.org/readme-banner-image)](https://odoo-community.org/get-involved?utm_source=repo-readme) + +# web [![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=19.0) [![Pre-commit Status](https://github.com/OCA/web/actions/workflows/pre-commit.yml/badge.svg?branch=19.0)](https://github.com/OCA/web/actions/workflows/pre-commit.yml?query=branch%3A19.0) [![Build Status](https://github.com/OCA/web/actions/workflows/test.yml/badge.svg?branch=19.0)](https://github.com/OCA/web/actions/workflows/test.yml?query=branch%3A19.0) @@ -7,8 +10,6 @@ -# web - web @@ -27,7 +28,7 @@ addon | version | maintainers | summary [web_company_context_highlight](web_company_context_highlight/) | 19.0.1.0.0 | pverkest | Highlight the company switcher when multiple companies are selected [web_dark_mode](web_dark_mode/) | 19.0.1.0.0 | | Enabled Dark Mode for the Odoo Backend [web_date_format_numeric](web_date_format_numeric/) | 19.0.1.0.0 | | Display all date/datetime fields in numeric format -[web_dialog_size](web_dialog_size/) | 19.0.1.0.3 | | A module that lets the user expand a dialog box to the full screen width. +[web_dialog_size](web_dialog_size/) | 19.0.1.0.4 | | A module that lets the user expand a dialog box to the full screen width. [web_editor_class_selector](web_editor_class_selector/) | 19.0.1.0.0 | carlos-lopez-tecnativa | Web editor class selector [web_environment_ribbon](web_environment_ribbon/) | 19.0.1.0.0 | | Web Environment Ribbon [web_favicon](web_favicon/) | 19.0.1.0.1 | | Allows to set a custom shortcut icon (aka favicon) @@ -37,7 +38,7 @@ addon | version | maintainers | summary [web_ir_actions_act_multi](web_ir_actions_act_multi/) | 19.0.1.0.0 | | Enables triggering of more than one action on ActionManager [web_ir_actions_act_window_message](web_ir_actions_act_window_message/) | 19.0.1.0.0 | hbrunn | Show a message box to users [web_m2x_options](web_m2x_options/) | 19.0.1.0.2 | | web_m2x_options -[web_m2x_options_manager](web_m2x_options_manager/) | 19.0.1.0.0 | | Adds an interface to manage the "Create" and "Create and Edit" options for specific models and fields. +[web_m2x_options_manager](web_m2x_options_manager/) | 19.0.1.0.1 | | Adds an interface to manage the "Create" and "Create and Edit" options for specific models and fields. [web_no_bubble](web_no_bubble/) | 19.0.1.0.0 | | Remove the bubbles from the web interface [web_notify](web_notify/) | 19.0.1.0.1 | | Send notification messages to user [web_notify_upgrade](web_notify_upgrade/) | 19.0.1.0.0 | | Notify active users when a module is installed or updated @@ -48,11 +49,13 @@ addon | version | maintainers | summary [web_responsive](web_responsive/) | 19.0.1.1.1 | Tardo SplashS | Responsive web client, community-supported [web_search_deactivate_autosearch](web_search_deactivate_autosearch/) | 19.0.1.0.0 | samirGuesmi AnizR | Allow user to deactivate autosearch to add multiple filters [web_search_with_and](web_search_with_and/) | 19.0.1.0.0 | | Use AND conditions on omnibar search +[web_theme_classic](web_theme_classic/) | 19.0.1.0.0 | legalsylvain | Contrasted style on fields to improve the UI. [web_timeline](web_timeline/) | 19.0.1.0.1 | | Interactive visualization chart to show events in time [web_tree_many2one_clickable](web_tree_many2one_clickable/) | 19.0.1.1.0 | | Open the linked resource when clicking on their name [web_widget_bokeh_chart](web_widget_bokeh_chart/) | 19.0.1.0.1 | LoisRForgeFlow JasminSForgeFlow | This widget allows to display charts using Bokeh library. [web_widget_domain_editor_dialog](web_widget_domain_editor_dialog/) | 19.0.1.0.0 | | Recovers the Domain Editor Dialog functionality [web_widget_dropdown_dynamic](web_widget_dropdown_dynamic/) | 19.0.1.0.0 | | This module adds support for dynamic dropdown widget +[web_widget_mpld3_chart](web_widget_mpld3_chart/) | 19.0.1.0.1 | JordiBForgeFlow ThiagoMForgeFlow | This widget allows to display charts using MPLD3 library. [web_widget_numeric_step](web_widget_numeric_step/) | 19.0.1.0.0 | rafaelbn yajo | Web Widget Numeric Step [web_widget_one2many_tree_line_duplicate](web_widget_one2many_tree_line_duplicate/) | 19.0.1.0.1 | | Web Widget One2many Tree Line Duplicate [web_widget_popover](web_widget_popover/) | 19.0.1.0.0 | ivantodorovich | Render an icon that displays the field content in a popover diff --git a/checklog-odoo.cfg b/checklog-odoo.cfg index 505df81d0416..76227c0f4be9 100644 --- a/checklog-odoo.cfg +++ b/checklog-odoo.cfg @@ -1,4 +1,7 @@ [checklog-odoo] ignore= WARNING.* 0 failed, 0 error\(s\).* - WARNING.*Killing chrome descendants-or-self.* + WARNING .* Killing chrome descendants-or-self .* + WARNING.* Missing widget: res_partner_many2one for field of type many2one.* + (?ms)WARNING.* odoo.addons.base.models.assetsbundle: Error: argument `[$]color` of `rgba[(][$]color, [$]alpha[)]` must be a color.*odoo/addons/web/static/lib/bootstrap/scss/mixins/_buttons.scss, in mixin `button-outline-variant`.* + WARNING .* odoo.tools.config: option addons_path, invalid addons directory .*, skipped diff --git a/renovate.json b/renovate.json new file mode 100644 index 000000000000..33c8981ca548 --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["config:recommended", ":disableDependencyDashboard"], + "baseBranchPatterns": ["20.0", "19.0", "18.0", "17.0", "16.0"], + "enabledManagers": ["copier"] +} diff --git a/requirements.txt b/requirements.txt index 63ae7d8d4fda..58f53b3690a1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ # generated from manifests external_dependencies bokeh==3.9.0 +mpld3==0.5.12 diff --git a/setup/_metapackage/pyproject.toml b/setup/_metapackage/pyproject.toml index 411476c54dfb..a50dd19f4ba8 100644 --- a/setup/_metapackage/pyproject.toml +++ b/setup/_metapackage/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "odoo-addons-oca-web" -version = "19.0.20261014.0" +version = "19.0.20261112.0" dependencies = [ "odoo-addon-web_calendar_slot_duration==19.0.*", "odoo-addon-web_chatter_position==19.0.*", @@ -29,11 +29,13 @@ dependencies = [ "odoo-addon-web_responsive==19.0.*", "odoo-addon-web_search_deactivate_autosearch==19.0.*", "odoo-addon-web_search_with_and==19.0.*", + "odoo-addon-web_theme_classic==19.0.*", "odoo-addon-web_timeline==19.0.*", "odoo-addon-web_tree_many2one_clickable==19.0.*", "odoo-addon-web_widget_bokeh_chart==19.0.*", "odoo-addon-web_widget_domain_editor_dialog==19.0.*", "odoo-addon-web_widget_dropdown_dynamic==19.0.*", + "odoo-addon-web_widget_mpld3_chart==19.0.*", "odoo-addon-web_widget_numeric_step==19.0.*", "odoo-addon-web_widget_one2many_tree_line_duplicate==19.0.*", "odoo-addon-web_widget_popover==19.0.*", diff --git a/web_dialog_size/README.rst b/web_dialog_size/README.rst index c3dd8f52f1e7..7ce3be4f4ce6 100644 --- a/web_dialog_size/README.rst +++ b/web_dialog_size/README.rst @@ -11,7 +11,7 @@ Web Dialog Size !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:a61aa1523f51b231231a6ac00281a7deaeee5652950e8c0363a0c6998a43342b + !! source digest: sha256:a84434a06cb2871575e7faaa4903c03513dfc539f951c33b55bec78b7a71450d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -96,6 +96,7 @@ Contributors - Jairo Llopis - Ernesto Tejeda - Carlos Roca + - Sergio Teruel - Sudhir Arya - Pierre Pizzetta diff --git a/web_dialog_size/__manifest__.py b/web_dialog_size/__manifest__.py index c43941aa90d1..a40f0e40ff2f 100644 --- a/web_dialog_size/__manifest__.py +++ b/web_dialog_size/__manifest__.py @@ -15,7 +15,7 @@ "Odoo Community Association (OCA)", "website": "https://github.com/OCA/web", "category": "web", - "version": "19.0.1.0.3", + "version": "19.0.1.0.4", "license": "AGPL-3", "depends": ["web"], "installable": True, diff --git a/web_dialog_size/readme/CONTRIBUTORS.md b/web_dialog_size/readme/CONTRIBUTORS.md index 9001cbc59192..e1992cc965e7 100644 --- a/web_dialog_size/readme/CONTRIBUTORS.md +++ b/web_dialog_size/readme/CONTRIBUTORS.md @@ -10,6 +10,7 @@ - Jairo Llopis - Ernesto Tejeda - Carlos Roca + - Sergio Teruel - Sudhir Arya \<\> - Pierre Pizzetta \<\> - Mantas Šniukas \<\> diff --git a/web_dialog_size/static/description/index.html b/web_dialog_size/static/description/index.html index df06a5bd2ee2..06cd74efb2b5 100644 --- a/web_dialog_size/static/description/index.html +++ b/web_dialog_size/static/description/index.html @@ -372,7 +372,7 @@

Web Dialog Size

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:a61aa1523f51b231231a6ac00281a7deaeee5652950e8c0363a0c6998a43342b +!! source digest: sha256:a84434a06cb2871575e7faaa4903c03513dfc539f951c33b55bec78b7a71450d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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

A module that lets the user expand/restore the dialog box size through a @@ -448,6 +448,7 @@

Contributors

  • Jairo Llopis
  • Ernesto Tejeda
  • Carlos Roca
  • +
  • Sergio Teruel
  • Sudhir Arya <sudhir@erpharbor.com>
  • diff --git a/web_dialog_size/static/src/js/web_dialog_size.esm.js b/web_dialog_size/static/src/js/web_dialog_size.esm.js index 6065b45e1f62..db16a30a6620 100644 --- a/web_dialog_size/static/src/js/web_dialog_size.esm.js +++ b/web_dialog_size/static/src/js/web_dialog_size.esm.js @@ -1,4 +1,4 @@ -import {Component, onWillRender} from "@odoo/owl"; +import {Component, onWillRender, onWillUpdateProps, useState} from "@odoo/owl"; import {ActionDialog} from "@web/webclient/actions/action_dialog"; import {Dialog} from "@web/core/dialog/dialog"; import {SelectCreateDialog} from "@web/views/view_dialogs/select_create_dialog"; @@ -6,10 +6,26 @@ import {patch} from "@web/core/utils/patch"; import {useService} from "@web/core/utils/hooks"; import {browser} from "@web/core/browser/browser"; -function triggerWindowResize() { - requestAnimationFrame(() => { - window.dispatchEvent(new Event("resize")); - }); +/** + * Resizing a list column by hand fixes the width of the table and its parent in + * pixels, so the list no longer follows the dialog width. Unset them to let the + * list fit its columns to the new dialog size. + * + * A window resize event would do it too, but it also closes every component + * listening to it, such as the analytic distribution widget, and with it the + * "Search More..." dialog it opened. + * + * @param {HTMLElement} el element inside the dialog + */ +function resetListColumnWidths(el) { + const dialog = el.closest(".modal-content"); + if (!dialog) { + return; + } + for (const table of dialog.querySelectorAll(".o_list_table")) { + table.style.width = ""; + table.parentElement.style.width = ""; + } } export class ExpandButton extends Component { @@ -18,19 +34,32 @@ export class ExpandButton extends Component { ? this.props.getoriginalsize() : this.props.getsize() !== "dialog_full_screen" ? this.props.getsize() - : "md"; + : Dialog.defaultProps.size; + // The props never change, so the dialog rendering does not render + // this button again: keep the size in its own state to switch icons + this.state = useState({size: this.props.getsize()}); + // The dialog may be resized from outside the button, e.g. when the + // default maximize setting is applied once the server answers + onWillUpdateProps((nextProps) => { + this.state.size = nextProps.size; + }); + } + + setSize(size) { + this.props.setsize(size); + this.state.size = size; } - dialog_button_extend() { - this.props.setsize("dialog_full_screen"); + dialog_button_extend(ev) { + resetListColumnWidths(ev.currentTarget); + this.setSize("dialog_full_screen"); browser.localStorage.setItem("odoo.web_dialog_size.value", "true"); - triggerWindowResize(); } - dialog_button_restore() { - this.props.setsize(this.original_size); + dialog_button_restore(ev) { + resetListColumnWidths(ev.currentTarget); + this.setSize(this.original_size); browser.localStorage.setItem("odoo.web_dialog_size.value", "false"); - triggerWindowResize(); } } @@ -39,6 +68,7 @@ ExpandButton.template = "web_dialog_size.ExpandButton"; patch(Dialog.prototype, { setup() { this.originalSize = this.props.size; + this._parentSize = this.props.size; super.setup(); this.setSize = this.setSize.bind(this); this.getSize = this.getSize.bind(this); @@ -72,7 +102,7 @@ patch(Dialog.prototype, { if (serverValue === "true") { this.setSize("dialog_full_screen"); } else if (this._forcedSize === "dialog_full_screen") { - this.setSize(this.originalSize || "md"); + this.setSize(this.originalSize || Dialog.defaultProps.size); } } } @@ -81,6 +111,18 @@ patch(Dialog.prototype, { // Session likely expired → ignore }); + onWillUpdateProps((nextProps) => { + // A size coming from the parent (e.g. the expand button of a + // SelectCreateDialog, which wraps this dialog) replaces the forced + // one. Otherwise the dialog could never leave its forced size. + if (nextProps.size !== this._parentSize) { + this._parentSize = nextProps.size; + if (this._forcedSize) { + this._forcedSize = nextProps.size; + } + } + }); + onWillRender(() => { if (this._forcedSize && this.props.size !== this._forcedSize) { this.props.size = this._forcedSize; @@ -99,7 +141,7 @@ patch(Dialog.prototype, { }, getOriginalSize() { - return this.originalSize || "md"; + return this.originalSize || Dialog.defaultProps.size; }, }); @@ -137,7 +179,7 @@ patch(SelectCreateDialog.prototype, { if (serverValue === "true") { this.setSize("dialog_full_screen"); } else if (this.props.size === "dialog_full_screen") { - this.setSize(this.originalSize || "md"); + this.setSize(this.originalSize || Dialog.defaultProps.size); } } } @@ -157,7 +199,7 @@ patch(SelectCreateDialog.prototype, { }, getOriginalSize() { - return this.originalSize || "md"; + return this.originalSize || Dialog.defaultProps.size; }, }); diff --git a/web_dialog_size/static/src/xml/ExpandButton.xml b/web_dialog_size/static/src/xml/ExpandButton.xml index 71ce28c91058..10a0c50e3d3a 100644 --- a/web_dialog_size/static/src/xml/ExpandButton.xml +++ b/web_dialog_size/static/src/xml/ExpandButton.xml @@ -2,7 +2,7 @@