From 3150bb7bb65d2a8db3ff1177b3d5d602e15c12c1 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Fri, 8 Aug 2025 12:20:54 -0500 Subject: [PATCH 1/2] [IMP] web_widget_product_label_section_and_note: force a width on the column Odoo does not facilitate inheritance in the function https://github.com/odoo/odoo/blob/3bc173a6b22f2e360ec363277800ee5efa12088f/addons/web/static/src/views/list/list_renderer.js#L406 so it is necessary to force a max width at this low level. In v18, Odoo provides an attribute at the field level https://github.com/odoo/odoo/blob/1702cb44ab7692d70bfabfc25db9592dac85e7a2/addons/web/static/src/views/list/column_width_hook.js#L299 and in this widget Odoo uses a default value, which we also use here, see https://github.com/odoo/odoo/blob/1702cb44ab7692d70bfabfc25db9592dac85e7a2/addons/account/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.js#L249 --- ...product_label_section_and_note_field.esm.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.esm.js b/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.esm.js index 4d2bdc032569..c5a338d6853a 100644 --- a/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.esm.js +++ b/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.esm.js @@ -298,3 +298,21 @@ export const productLabelSectionAndNoteField = { registry .category("fields") .add("product_label_section_and_note_field", productLabelSectionAndNoteField); + +// Patch HTMLElement to set a max width on the product and label field cells. +// Odoo does not facilitate inheritance in the function computeColumnWidthsFromContent, +// so we need to patch the getBoundingClientRect method to enforce a max width. +const originalGetBoundingClientRect = HTMLElement.prototype.getBoundingClientRect; +HTMLElement.prototype.getBoundingClientRect = function () { + const rect = originalGetBoundingClientRect.call(this); + if ( + this.classList && + this.classList.contains("o_product_label_section_and_note_field_cell") + ) { + return { + ...rect, + width: Math.min(rect.width, 400), // Set your desired max width here + }; + } + return rect; +}; From c385b42a9d89464001e2c582a6dfa967b68ef789 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 12 Aug 2025 13:09:09 +0000 Subject: [PATCH 2/2] [BOT] post-merge updates --- README.md | 2 +- .../README.rst | 8 +++-- .../__manifest__.py | 2 +- .../static/description/index.html | 32 +++++++++++-------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 0f7c1c833a5d..c33d3d1c0073 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ addon | version | maintainers | summary [web_widget_numeric_step](web_widget_numeric_step/) | 17.0.1.0.0 | rafaelbn yajo | Web Widget Numeric Step [web_widget_open_tab](web_widget_open_tab/) | 17.0.1.0.0 | | Allow to open record from trees on new tab from tree views [web_widget_plotly_chart](web_widget_plotly_chart/) | 17.0.1.0.0 | robyf70 | Allow to draw plotly charts. -[web_widget_product_label_section_and_note](web_widget_product_label_section_and_note/) | 17.0.1.0.0 | | unify the product and name into a single column +[web_widget_product_label_section_and_note](web_widget_product_label_section_and_note/) | 17.0.1.0.1 | | unify the product and name into a single column [web_widget_section_and_note_text_scrollable](web_widget_section_and_note_text_scrollable/) | 17.0.1.0.0 | ivantodorovich | Make the text field of Section and Note widget scrollable [web_widget_url_advanced](web_widget_url_advanced/) | 17.0.1.0.0 | | This module extends URL widget for displaying anchors with custom labels. [web_widget_x2many_2d_matrix](web_widget_x2many_2d_matrix/) | 17.0.2.0.0 | JasminSForgeFlow hbrunn | Show list fields as a matrix diff --git a/web_widget_product_label_section_and_note/README.rst b/web_widget_product_label_section_and_note/README.rst index 66970020ca3b..5543adb61201 100644 --- a/web_widget_product_label_section_and_note/README.rst +++ b/web_widget_product_label_section_and_note/README.rst @@ -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 + ========================================= Web widget product label section and note ========================================= @@ -7,13 +11,13 @@ Web widget product label section and note !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:709ddfea019ddd0adedf75e793c8fdb77cc4329f0e6c02f9e78e2f3c99c9a5b6 + !! source digest: sha256:f337be9d3a849faaacd2915b7068977f1f6d6c5d8c515243078ec7e7a067f92f !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |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-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png :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 diff --git a/web_widget_product_label_section_and_note/__manifest__.py b/web_widget_product_label_section_and_note/__manifest__.py index 3d0121a4a3e7..1a26acec403e 100644 --- a/web_widget_product_label_section_and_note/__manifest__.py +++ b/web_widget_product_label_section_and_note/__manifest__.py @@ -1,6 +1,6 @@ { "name": "Web widget product label section and note", - "version": "17.0.1.0.0", + "version": "17.0.1.0.1", "summary": "unify the product and name into a single column", "author": "Tecnativa, Odoo Community Association (OCA), Odoo S.A.", "website": "https://github.com/OCA/web", diff --git a/web_widget_product_label_section_and_note/static/description/index.html b/web_widget_product_label_section_and_note/static/description/index.html index da63ae5fecbf..499625585d0c 100644 --- a/web_widget_product_label_section_and_note/static/description/index.html +++ b/web_widget_product_label_section_and_note/static/description/index.html @@ -3,7 +3,7 @@ -Web widget product label section and note +README.rst -
-

Web widget product label section and note

+
+ + +Odoo Community Association + +
+

Web widget product label section and note

-

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 unifies the product and name into a single column, making it more user-friendly and space-saving.

Table of contents

@@ -388,7 +393,7 @@

Web widget product label section and note

-

Configuration

+

Configuration

To extend this functionality to other modules (for example, Purchase), in a new module, it is necessary to create an inherited view to change the widget for these fields:

@@ -400,7 +405,7 @@

Configuration

-

Usage

+

Usage

  • Go to the Invoicing > Customers > Invoices and add a new line.
  • The product label must be displayed just after the product name.
  • @@ -409,7 +414,7 @@

    Usage

-

Known issues / Roadmap

+

Known issues / Roadmap

  • Add compatibility with sale_product_configurator module
  • Add compatibility with purchase_product_matrix module
  • @@ -421,7 +426,7 @@

    Known issues / Roadmap

-

Bug Tracker

+

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 @@ -429,16 +434,16 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Tecnativa
  • Odoo S.A.
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -464,5 +469,6 @@

Maintainers

+