diff --git a/web_widget_product_label_section_and_note_full_label/README.rst b/web_widget_product_label_section_and_note_full_label/README.rst new file mode 100644 index 000000000000..c9c52d370175 --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/README.rst @@ -0,0 +1,97 @@ +.. 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 Full Label +==================================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:800a8d5a3a72c6a8ec12f04e78406df19c6ed203d8cbee0d6a4fe78bed776e7a + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/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 + :target: https://github.com/OCA/web/tree/19.0/web_widget_product_label_section_and_note_full_label + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-19-0/web-19-0-web_widget_product_label_section_and_note_full_label + :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=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Always display the full label in the *product_label_section_and_note* +widget. + +When using this widget (usually on purchase order lines and invoice +lines) the name or description of the line is treated by this widget to +display only certain information from the name, in what is called the +label of the widget. + +More specifically, it removes the product name from the label (if +present), making it confusing in case you want to remove the actual +product name from the line description. + +With this module, you always see the full content of the line name or +description in the label section of the widget. Although it can contain +doubled information (for example, if the description of the line is +exactly the same as the product name), it makes the edition of the line +description more clear and user-friendly. + +**Table of contents** + +.. contents:: + :local: + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ForgeFlow + +Contributors +------------ + +- Laura Cazorla laura.cazorla@forgeflow.com +- David Vidal (`Moduon `__) + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_widget_product_label_section_and_note_full_label/__init__.py b/web_widget_product_label_section_and_note_full_label/__init__.py new file mode 100644 index 000000000000..dd99292f2036 --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/__init__.py @@ -0,0 +1,2 @@ +# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com) +# Part of ForgeFlow. See LICENSE file for full copyright and licensing details. diff --git a/web_widget_product_label_section_and_note_full_label/__manifest__.py b/web_widget_product_label_section_and_note_full_label/__manifest__.py new file mode 100644 index 000000000000..49acc6eecf5d --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com) +# Part of ForgeFlow. See LICENSE file for full copyright and licensing details. + +{ + "name": "Web Widget Product Label Section And Note Full Label", + "summary": "Display the full label in the product_label_section_and_note widget.", + "version": "19.0.1.0.0", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "license": "AGPL-3", + "depends": ["account", "web"], + "assets": { + "web.assets_backend": [ + "web_widget_product_label_section_and_note_full_label/static/src/**/*.js", + "web_widget_product_label_section_and_note_full_label/static/src/**/*.xml", + ], + "web.qunit_suite_tests": [ + "web_widget_product_label_section_and_note_full_label/static/tests/**/*.js", + ], + }, + "application": False, + "installable": True, +} diff --git a/web_widget_product_label_section_and_note_full_label/i18n/it.po b/web_widget_product_label_section_and_note_full_label/i18n/it.po new file mode 100644 index 000000000000..c0d5085374bd --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/i18n/it.po @@ -0,0 +1,14 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" diff --git a/web_widget_product_label_section_and_note_full_label/i18n/web_widget_product_label_section_and_note_full_label.pot b/web_widget_product_label_section_and_note_full_label/i18n/web_widget_product_label_section_and_note_full_label.pot new file mode 100644 index 000000000000..aadee09bfeda --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/i18n/web_widget_product_label_section_and_note_full_label.pot @@ -0,0 +1,13 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" diff --git a/web_widget_product_label_section_and_note_full_label/pyproject.toml b/web_widget_product_label_section_and_note_full_label/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_widget_product_label_section_and_note_full_label/readme/CONTRIBUTORS.md b/web_widget_product_label_section_and_note_full_label/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..36f4e66ccc77 --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Laura Cazorla +- David Vidal ([Moduon](https://www.moduon.team/)) diff --git a/web_widget_product_label_section_and_note_full_label/readme/DESCRIPTION.md b/web_widget_product_label_section_and_note_full_label/readme/DESCRIPTION.md new file mode 100644 index 000000000000..46c426a03c54 --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/readme/DESCRIPTION.md @@ -0,0 +1,15 @@ +Always display the full label in the *product_label_section_and_note* widget. + +When using this widget (usually on purchase order lines and invoice lines) the +name or description of the line is treated by this widget to display only +certain information from the name, in what is called the label of the widget. + +More specifically, it removes the product name from the label (if present), +making it confusing in case you want to remove the actual product name from +the line description. + +With this module, you always see the full content of the line name or +description in the label section of the widget. Although it can contain doubled +information (for example, if the description of the line is exactly the same as +the product name), it makes the edition of the line description more clear and +user-friendly. diff --git a/web_widget_product_label_section_and_note_full_label/static/description/icon.png b/web_widget_product_label_section_and_note_full_label/static/description/icon.png new file mode 100644 index 000000000000..1dcc49c24f36 Binary files /dev/null and b/web_widget_product_label_section_and_note_full_label/static/description/icon.png differ diff --git a/web_widget_product_label_section_and_note_full_label/static/description/index.html b/web_widget_product_label_section_and_note_full_label/static/description/index.html new file mode 100644 index 000000000000..277618743e14 --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/static/description/index.html @@ -0,0 +1,443 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Web Widget Product Label Section And Note Full Label

+ +

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

+

Always display the full label in the product_label_section_and_note +widget.

+

When using this widget (usually on purchase order lines and invoice +lines) the name or description of the line is treated by this widget to +display only certain information from the name, in what is called the +label of the widget.

+

More specifically, it removes the product name from the label (if +present), making it confusing in case you want to remove the actual +product name from the line description.

+

With this module, you always see the full content of the line name or +description in the label section of the widget. Although it can contain +doubled information (for example, if the description of the line is +exactly the same as the product name), it makes the edition of the line +description more clear and user-friendly.

+

Table of contents

+ +
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +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.

+

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

+
+
+
+
+ + diff --git a/web_widget_product_label_section_and_note_full_label/static/src/product_label_section_and_note_field/product_label_section_and_note_field.esm.js b/web_widget_product_label_section_and_note_full_label/static/src/product_label_section_and_note_field/product_label_section_and_note_field.esm.js new file mode 100644 index 000000000000..e6d47a8e8692 --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/static/src/product_label_section_and_note_field/product_label_section_and_note_field.esm.js @@ -0,0 +1,14 @@ +/* Copyright 2025 ForgeFlow S.L. + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + +import {ProductLabelSectionAndNoteField} from "@account/components/product_label_section_and_note_field/product_label_section_and_note_field"; +import {patch} from "@web/core/utils/patch"; + +patch(ProductLabelSectionAndNoteField.prototype, { + get label() { + return this.props.record.data.name; + }, + parseLabel(value) { + return (!value && this.productName) || value; + }, +}); diff --git a/web_widget_product_label_section_and_note_full_label/static/src/product_label_section_and_note_field/product_label_section_and_note_field.xml b/web_widget_product_label_section_and_note_full_label/static/src/product_label_section_and_note_field/product_label_section_and_note_field.xml new file mode 100644 index 000000000000..d7ce031986cb --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/static/src/product_label_section_and_note_field/product_label_section_and_note_field.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/web_widget_product_label_section_and_note_full_label/static/tests/product_label_section_and_note_field_tests.esm.js b/web_widget_product_label_section_and_note_full_label/static/tests/product_label_section_and_note_field_tests.esm.js new file mode 100644 index 000000000000..5a99967994db --- /dev/null +++ b/web_widget_product_label_section_and_note_full_label/static/tests/product_label_section_and_note_field_tests.esm.js @@ -0,0 +1,47 @@ +/* global QUnit */ + +import "@web_widget_product_label_section_and_note_full_label/product_label_section_and_note_field/product_label_section_and_note_field.esm"; +import {ProductLabelSectionAndNoteField} from "@account/components/product_label_section_and_note_field/product_label_section_and_note_field"; + +QUnit.module("web_widget_product_label_section_and_note_full_label"); + +QUnit.test("product label widget shows and stores the full line name", (assert) => { + const widget = Object.create(ProductLabelSectionAndNoteField.prototype); + + widget.props = { + name: "product_id", + record: { + data: { + product_id: { + display_name: "Test Product", + }, + name: "Test Product\nCustom description", + display_type: false, + }, + evalContext: { + parent: { + state: "draft", + locked: false, + }, + }, + }, + }; + + assert.strictEqual( + widget.label, + "Test Product\nCustom description", + "The label should expose the full line name, not strip the product name" + ); + + assert.strictEqual( + widget.parseLabel("Test Product\nChanged description"), + "Test Product\nChanged description", + "Saving the textarea value should keep the full label unchanged" + ); + + assert.strictEqual( + widget.parseLabel(""), + "Test Product", + "Clearing the label should fall back to the product name" + ); +});