diff --git a/web_widget_product_label_section_and_note_name_visibility/README.rst b/web_widget_product_label_section_and_note_name_visibility/README.rst new file mode 100644 index 000000000000..f386f18bbe59 --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/README.rst @@ -0,0 +1,105 @@ +.. 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 +========================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:4c8ff177dd08e3c63b37a6d3912b38e75ea786c15250679acf3b73e4460e7b07 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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_name_visibility + :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_name_visibility + :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| + +This module extends the Odoo feature introduced in V18 to allow the user +to decide whether to show or hide the product name in the description. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +- Go to the **Invoicing > Customers > Invoices** and add a new line. +- The product label must be displayed just after the product name. +- An eye-style icon is displayed; click it to toggle the product name. + +Known issues / Roadmap +====================== + +- Add compatibility with purchase_product_matrix module + +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 +------- + +* Tecnativa +* Odoo S.A. + +Contributors +------------ + +- `Tecnativa `__: + + - Pedro M. Baeza + - Carlos Lopez + +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. + +.. |maintainer-carlos-lopez-tecnativa| image:: https://github.com/carlos-lopez-tecnativa.png?size=40px + :target: https://github.com/carlos-lopez-tecnativa + :alt: carlos-lopez-tecnativa + +Current `maintainer `__: + +|maintainer-carlos-lopez-tecnativa| + +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_name_visibility/__init__.py b/web_widget_product_label_section_and_note_name_visibility/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/web_widget_product_label_section_and_note_name_visibility/__manifest__.py b/web_widget_product_label_section_and_note_name_visibility/__manifest__.py new file mode 100644 index 000000000000..92120ae311b9 --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/__manifest__.py @@ -0,0 +1,24 @@ +{ + "name": "Web widget product label section and note", + "version": "19.0.2.0.0", + "summary": "Alternate the visibility of the product and description.", + "author": "Tecnativa, Odoo Community Association (OCA), Odoo S.A.", + "website": "https://github.com/OCA/web", + "depends": [ + "web", + "account", + ], + "assets": { + "web.assets_backend": [ + ( + "after", + "account/static/src/components/**/*", + "web_widget_product_label_section_and_note_name_visibility/static/src/components/**/*", + ) + ], + }, + "installable": True, + "auto_install": False, + "license": "AGPL-3", + "maintainers": ["carlos-lopez-tecnativa"], +} diff --git a/web_widget_product_label_section_and_note_name_visibility/i18n/it.po b/web_widget_product_label_section_and_note_name_visibility/i18n/it.po new file mode 100644 index 000000000000..5d59a2be4032 --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/i18n/it.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_product_label_section_and_note +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-12-14 11:06+0000\n" +"Last-Translator: mymage \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" +"X-Generator: Weblate 5.6.2\n" + +#. module: web_widget_product_label_section_and_note_name_visibility +#. odoo-javascript +#: code:addons/web_widget_product_label_section_and_note_name_visibility/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +msgid "Click to remove/add the product name from the description." +msgstr "" +"Fare clic per rimuovere/aggiungere il nome del prodotto dalla descrizione." + +#, python-format +#~ msgid "Click or press enter to add a description" +#~ msgstr "Fare clic o premere invio per aggiungere una descrizione" + +#, python-format +#~ msgid "Enter a description" +#~ msgstr "Inserire una descrizione" + +#, python-format +#~ msgid "Internal link" +#~ msgstr "Link interno" + +#, python-format +#~ msgid "Scan barcode" +#~ msgstr "Leggi codice a barre" + +#, python-format +#~ msgid "Search a product" +#~ msgstr "Cerca un prodotto" diff --git a/web_widget_product_label_section_and_note_name_visibility/i18n/web_widget_product_label_section_and_note.pot b/web_widget_product_label_section_and_note_name_visibility/i18n/web_widget_product_label_section_and_note.pot new file mode 100644 index 000000000000..9330f8f8055f --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/i18n/web_widget_product_label_section_and_note.pot @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_product_label_section_and_note +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.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" + +#. module: web_widget_product_label_section_and_note +#. odoo-javascript +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#, python-format +msgid "Click or press enter to add a description" +msgstr "" + +#. module: web_widget_product_label_section_and_note +#. odoo-javascript +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#, python-format +msgid "Click to remove/add the product name from the description." +msgstr "" + +#. module: web_widget_product_label_section_and_note +#. odoo-javascript +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#, python-format +msgid "Enter a description" +msgstr "" + +#. module: web_widget_product_label_section_and_note +#. odoo-javascript +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#, python-format +msgid "Internal link" +msgstr "" + +#. module: web_widget_product_label_section_and_note +#. odoo-javascript +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#, python-format +msgid "Scan barcode" +msgstr "" + +#. module: web_widget_product_label_section_and_note +#. odoo-javascript +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.esm.js:0 +#: code:addons/web_widget_product_label_section_and_note/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +#, python-format +msgid "Search a product" +msgstr "" diff --git a/web_widget_product_label_section_and_note_name_visibility/i18n/web_widget_product_label_section_and_note_name_visibility.pot b/web_widget_product_label_section_and_note_name_visibility/i18n/web_widget_product_label_section_and_note_name_visibility.pot new file mode 100644 index 000000000000..e15f86c1c61f --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/i18n/web_widget_product_label_section_and_note_name_visibility.pot @@ -0,0 +1,20 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_product_label_section_and_note_name_visibility +# +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" + +#. module: web_widget_product_label_section_and_note_name_visibility +#. odoo-javascript +#: code:addons/web_widget_product_label_section_and_note_name_visibility/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml:0 +msgid "Click to remove/add the product name from the description." +msgstr "" diff --git a/web_widget_product_label_section_and_note_name_visibility/pyproject.toml b/web_widget_product_label_section_and_note_name_visibility/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_widget_product_label_section_and_note_name_visibility/readme/CONTRIBUTORS.md b/web_widget_product_label_section_and_note_name_visibility/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..bc7e72181c8d --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- [Tecnativa](https://www.tecnativa.com): + + > - Pedro M. Baeza + > - Carlos Lopez diff --git a/web_widget_product_label_section_and_note_name_visibility/readme/DESCRIPTION.md b/web_widget_product_label_section_and_note_name_visibility/readme/DESCRIPTION.md new file mode 100644 index 000000000000..9e60d3a13048 --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module extends the Odoo feature introduced in V18 to allow the user to decide whether to show or hide the product name in the description. \ No newline at end of file diff --git a/web_widget_product_label_section_and_note_name_visibility/readme/ROADMAP.md b/web_widget_product_label_section_and_note_name_visibility/readme/ROADMAP.md new file mode 100644 index 000000000000..3a596575b6d2 --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/readme/ROADMAP.md @@ -0,0 +1 @@ +- Add compatibility with purchase_product_matrix module diff --git a/web_widget_product_label_section_and_note_name_visibility/readme/USAGE.md b/web_widget_product_label_section_and_note_name_visibility/readme/USAGE.md new file mode 100644 index 000000000000..9647c7b95dea --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/readme/USAGE.md @@ -0,0 +1,3 @@ +- Go to the **Invoicing \> Customers \> Invoices** and add a new line. +- The product label must be displayed just after the product name. +- An eye-style icon is displayed; click it to toggle the product name. \ No newline at end of file diff --git a/web_widget_product_label_section_and_note_name_visibility/static/description/icon.png b/web_widget_product_label_section_and_note_name_visibility/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/web_widget_product_label_section_and_note_name_visibility/static/description/icon.png differ diff --git a/web_widget_product_label_section_and_note_name_visibility/static/description/index.html b/web_widget_product_label_section_and_note_name_visibility/static/description/index.html new file mode 100644 index 000000000000..cd9396de4049 --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/static/description/index.html @@ -0,0 +1,456 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Web widget product label section and note

+ +

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

+

This module extends the Odoo feature introduced in V18 to allow the user +to decide whether to show or hide the product name in the description.

+

Table of contents

+ +
+

Usage

+
    +
  • Go to the Invoicing > Customers > Invoices and add a new line.
  • +
  • The product label must be displayed just after the product name.
  • +
  • An eye-style icon is displayed; click it to toggle the product name.
  • +
+
+
+

Known issues / Roadmap

+
    +
  • Add compatibility with purchase_product_matrix module
  • +
+
+
+

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

+
    +
  • Tecnativa
  • +
  • Odoo S.A.
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:

    +
    +
      +
    • Pedro M. Baeza
    • +
    • Carlos Lopez
    • +
    +
    +
  • +
+
+
+

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.

+

Current maintainer:

+

carlos-lopez-tecnativa

+

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_name_visibility/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_name_visibility/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.esm.js new file mode 100644 index 000000000000..a19a8bb95392 --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.esm.js @@ -0,0 +1,52 @@ +/* Copyright Odoo S.A. + * Copyright 2025 Tecnativa - Carlos Lopez + * 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"; +import {useRecordObserver} from "@web/model/relational_model/utils"; +import {useState} from "@odoo/owl"; + +patch(ProductLabelSectionAndNoteField.prototype, { + setup() { + super.setup(...arguments); + this.isProductVisible = useState({value: false}); + useRecordObserver((record) => { + const rawName = record.data.name || ""; + const productName = record.data[this.props.name]?.display_name || ""; + const expectedVisible = productName + ? rawName.startsWith(productName) + : false; + if (this.isProductVisible.value !== expectedVisible) { + this.isProductVisible.value = expectedVisible; + } + }); + }, + get label() { + let label = this.props.record.data[this.descriptionColumn] || ""; + if (this.productName && label.startsWith(this.productName)) { + label = label.slice(this.productName.length + 1); + } + return label.trim(); + }, + switchProductVisibility() { + let new_name = ""; + if (this.isProductVisible.value && this.productName) { + new_name = this.label; + } else { + new_name = this.productName + "\n" + this.label; + } + this.props.record.update({name: new_name}); + this.isProductVisible.value = !this.isProductVisible.value; + }, + updateLabel(value) { + this.props.record.update({ + name: + this.productName && + this.productName !== value && + this.isProductVisible.value + ? `${this.productName}\n${value}` + : value, + }); + }, +}); diff --git a/web_widget_product_label_section_and_note_name_visibility/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.scss b/web_widget_product_label_section_and_note_name_visibility/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.scss new file mode 100644 index 000000000000..ee4dcfb5bcbe --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.scss @@ -0,0 +1,23 @@ +.o_external_button#ProductVisibilityButtonId { + opacity: 0; + transition: + opacity 0.15s, + color 0.15s; +} + +tr.o_selected_row .o_external_button#ProductVisibilityButtonId, +tr.o_row_draggable + .o_field_product_label_section_and_note_field:hover + .o_external_button#ProductVisibilityButtonId { + opacity: 1; +} + +.o_field_product_label_section_and_note_field + .o_external_button#ProductVisibilityButtonId:hover { + color: rgba(var(--link-color-rgb), var(--link-opacity, 1)); +} + +.o_field_product_label_section_and_note_field + .o_external_button#ProductVisibilityButtonId:active { + color: rgba(var(--link-hover-color-rgb), var(--link-opacity, 1)); +} diff --git a/web_widget_product_label_section_and_note_name_visibility/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml b/web_widget_product_label_section_and_note_name_visibility/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml new file mode 100644 index 000000000000..89a8a245fba6 --- /dev/null +++ b/web_widget_product_label_section_and_note_name_visibility/static/src/components/product_label_section_and_note_field/product_label_section_and_note_field.xml @@ -0,0 +1,28 @@ + + + + + + +