diff --git a/sale_layout_category_hide_detail/README.rst b/sale_layout_category_hide_detail/README.rst new file mode 100644 index 00000000..39bfa3dd --- /dev/null +++ b/sale_layout_category_hide_detail/README.rst @@ -0,0 +1,116 @@ +================================ +Sale layout category hide detail +================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:0d153ad4919145d5c976bbfabb0e81a1bfc44a49bff302821560ef08829cdd1a + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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 + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/sale-reporting/tree/17.0/sale_layout_category_hide_detail + :alt: OCA/sale-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-reporting-17-0/sale-reporting-17-0-sale_layout_category_hide_detail + :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/sale-reporting&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to check/uncheck the new 'Show details' and 'Show +subtotal' flags in *Sale order section lines* and *Customer invoice +section lines* if you want to show or hide their lines or their +subtotals in the PDF report and in the website. You can also show or +hide the section subtotal and line amount by checking or unchecking the +new 'Show section subtotal' and 'Show line amount' flags. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +The flags on the right hand side of the sale order line allow you to +show or hide details, subtotal, line amount and section subtotal. + +These are the possible combinations: + +|Possible combinations| + +And these are the results in report: + +|Possible combination results in report| + +The behavior described before is the same for Quotations and Invoices. + +.. |Possible combinations| image:: https://raw.githubusercontent.com/OCA/sale-reporting/17.0/sale_layout_category_hide_detail/static/description/readme-icons/order.png +.. |Possible combination results in report| image:: https://raw.githubusercontent.com/OCA/sale-reporting/17.0/sale_layout_category_hide_detail/static/description/readme-icons/report.png + +Known issues / Roadmap +====================== + +- The boolean_fa_icon widget has not been extracted to a module into + OCA/web because until now this widget has not been needed for + anything else, but it's good that in the future that would be done. + +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 + +Contributors +------------ + +- `Tecnativa `__: + + - Ernesto Tejeda + - Pedro M. Baeza + - Víctor Martínez + - Yadier Quesada + +- Denis Roussel +- Jeroen Evens +- Tris Doan + +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/sale-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_layout_category_hide_detail/__init__.py b/sale_layout_category_hide_detail/__init__.py new file mode 100644 index 00000000..83e553ac --- /dev/null +++ b/sale_layout_category_hide_detail/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/sale_layout_category_hide_detail/__manifest__.py b/sale_layout_category_hide_detail/__manifest__.py new file mode 100644 index 00000000..4a9a710d --- /dev/null +++ b/sale_layout_category_hide_detail/__manifest__.py @@ -0,0 +1,29 @@ +# Copyright 2018-2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Sale layout category hide detail", + "summary": "Hide details for sections in sale orders and invoices for " + "reports and customer portal", + "version": "17.0.1.0.0", + "category": "Sales Management", + "website": "https://github.com/OCA/sale-reporting", + "author": "Tecnativa, " "Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["sale_management"], + "data": [ + "views/account_move_view.xml", + "views/invoice_report_templates.xml", + "views/sale_views.xml", + "views/sale_order_report_templates.xml", + "views/sale_portal_templates.xml", + ], + "assets": { + "web.assets_backend": [ + "sale_layout_category_hide_detail/static/src/js/**", + "sale_layout_category_hide_detail/static/src/xml/*.xml", + ], + }, + "application": False, + "installable": True, +} diff --git a/sale_layout_category_hide_detail/i18n/es.po b/sale_layout_category_hide_detail/i18n/es.po new file mode 100644 index 00000000..d847372d --- /dev/null +++ b/sale_layout_category_hide_detail/i18n/es.po @@ -0,0 +1,127 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_layout_category_hide_detail +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-08-12 14:31+0000\n" +"PO-Revision-Date: 2023-09-03 13:40+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: \n" +"Language: es\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 4.17\n" + +#. module: sale_layout_category_hide_detail +#: model:ir.model,name:sale_layout_category_hide_detail.model_account_move_line +msgid "Journal Item" +msgstr "Apunte contable" + +#. module: sale_layout_category_hide_detail +#: model:ir.model,name:sale_layout_category_hide_detail.model_sale_order_line +msgid "Sales Order Line" +msgstr "Línea de pedido de venta" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_details +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_details +msgid "Show Details" +msgstr "Mostrar Detalles" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_line_amount +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_line_amount +msgid "Show Line Amount" +msgstr "Mostrar el Importe de la Línea" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_section_subtotal +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_section_subtotal +msgid "Show Section Subtotal" +msgstr "Mostrar subtotal de la sección" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_subtotal +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_subtotal +msgid "Show Subtotal" +msgstr "Mostrar Subtotal" + +#. module: sale_layout_category_hide_detail +#: model_terms:ir.ui.view,arch_db:sale_layout_category_hide_detail.report_saleorder_document_hide_detail +#: model_terms:ir.ui.view,arch_db:sale_layout_category_hide_detail.sale_order_portal_content_hide_detail +msgid "Subtotal" +msgstr "Subtotal" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Switch to: details hidden" +msgstr "Cambiar a: detalles ocultos" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Switch to: details shown" +msgstr "Cambiar a: detalles mostrados" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Toggle" +msgstr "Alternar" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,help:sale_layout_category_hide_detail.field_account_move_line__show_section_subtotal +#: model:ir.model.fields,help:sale_layout_category_hide_detail.field_sale_order_line__show_section_subtotal +msgid "Uncheck this if you want to hide the subtotal on section part" +msgstr "" +"Desmarque esta opción si desea ocultar el subtotal en la parte de la sección" + +#, python-format +#~ msgid "Click to check" +#~ msgstr "Click para marcar" + +#, python-format +#~ msgid "Click to uncheck" +#~ msgstr "Click para desmarcar" + +#, python-format +#~ msgid "Switch to: subtotal hidden" +#~ msgstr "Cambiar a: subtotal oculto" + +#, python-format +#~ msgid "Switch to: subtotal shown" +#~ msgstr "Cambiar a: subtotal mostrado" + +#, python-format +#~ msgid "Switch to: line amount hidden" +#~ msgstr "Cambiar a: cantidad de línea oculta" + +#, python-format +#~ msgid "Switch to: line amount shown" +#~ msgstr "Cambiar a: cantidad de linea mostrado" + +#, python-format +#~ msgid "Switch to: section subtotal hidden" +#~ msgstr "Cambiar a: seccion subtotal oculto" + +#, python-format +#~ msgid "Switch to: section subtotal shown" +#~ msgstr "Cambiar a: se muestra el subtotal de la sección" + +#~ msgid "Show details" +#~ msgstr "Mostrar detalles" + +#~ msgid "Show subtotal" +#~ msgstr "Mostrar subtotal" + +#~ msgid "Invoice Line" +#~ msgstr "Linea de factura" diff --git a/sale_layout_category_hide_detail/i18n/it.po b/sale_layout_category_hide_detail/i18n/it.po new file mode 100644 index 00000000..45479662 --- /dev/null +++ b/sale_layout_category_hide_detail/i18n/it.po @@ -0,0 +1,118 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_layout_category_hide_detail +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-12-06 17:34+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 4.17\n" + +#. module: sale_layout_category_hide_detail +#: model:ir.model,name:sale_layout_category_hide_detail.model_account_move_line +msgid "Journal Item" +msgstr "Movimento contabile" + +#. module: sale_layout_category_hide_detail +#: model:ir.model,name:sale_layout_category_hide_detail.model_sale_order_line +msgid "Sales Order Line" +msgstr "Riga ordine di vendita" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_details +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_details +msgid "Show Details" +msgstr "Mostra dettagli" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_line_amount +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_line_amount +msgid "Show Line Amount" +msgstr "Mostra importo riga" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_section_subtotal +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_section_subtotal +msgid "Show Section Subtotal" +msgstr "Mostra subtotale sezione" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_subtotal +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_subtotal +msgid "Show Subtotal" +msgstr "Mostra subtotale" + +#. module: sale_layout_category_hide_detail +#: model_terms:ir.ui.view,arch_db:sale_layout_category_hide_detail.report_saleorder_document_hide_detail +#: model_terms:ir.ui.view,arch_db:sale_layout_category_hide_detail.sale_order_portal_content_hide_detail +msgid "Subtotal" +msgstr "Subtotale" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Switch to: details hidden" +msgstr "Passa a: nascondi dettagli" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Switch to: details shown" +msgstr "Passa a: mostra dettagli" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Toggle" +msgstr "Inverti" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,help:sale_layout_category_hide_detail.field_account_move_line__show_section_subtotal +#: model:ir.model.fields,help:sale_layout_category_hide_detail.field_sale_order_line__show_section_subtotal +msgid "Uncheck this if you want to hide the subtotal on section part" +msgstr "Disabilita se vuoi nascondere il subtotale della sezione" + +#, python-format +#~ msgid "Click to check" +#~ msgstr "Click per abilitare" + +#, python-format +#~ msgid "Click to uncheck" +#~ msgstr "Click per disabilitare" + +#, python-format +#~ msgid "Switch to: subtotal hidden" +#~ msgstr "Passa a: nascondi subtotale" + +#, python-format +#~ msgid "Switch to: subtotal shown" +#~ msgstr "Passa a: mostra subtotale" + +#~ msgid "Display Name" +#~ msgstr "Nome visualizzato" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Ultima modifica il" + +#~ msgid "Show details" +#~ msgstr "Mostra dettagli" + +#~ msgid "Show line amount" +#~ msgstr "Mostra importo riga" + +#~ msgid "Show subtotal" +#~ msgstr "Mostra subtotale" diff --git a/sale_layout_category_hide_detail/i18n/pt_BR.po b/sale_layout_category_hide_detail/i18n/pt_BR.po new file mode 100644 index 00000000..366905f0 --- /dev/null +++ b/sale_layout_category_hide_detail/i18n/pt_BR.po @@ -0,0 +1,82 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_layout_category_hide_detail +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: pt_BR\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" + +#. module: sale_layout_category_hide_detail +#: model:ir.model,name:sale_layout_category_hide_detail.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model,name:sale_layout_category_hide_detail.model_sale_order_line +msgid "Sales Order Line" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_details +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_details +msgid "Show Details" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_line_amount +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_line_amount +msgid "Show Line Amount" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_section_subtotal +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_section_subtotal +msgid "Show Section Subtotal" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_subtotal +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_subtotal +msgid "Show Subtotal" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model_terms:ir.ui.view,arch_db:sale_layout_category_hide_detail.report_saleorder_document_hide_detail +#: model_terms:ir.ui.view,arch_db:sale_layout_category_hide_detail.sale_order_portal_content_hide_detail +msgid "Subtotal" +msgstr "" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Switch to: details hidden" +msgstr "" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Switch to: details shown" +msgstr "" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Toggle" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,help:sale_layout_category_hide_detail.field_account_move_line__show_section_subtotal +#: model:ir.model.fields,help:sale_layout_category_hide_detail.field_sale_order_line__show_section_subtotal +msgid "Uncheck this if you want to hide the subtotal on section part" +msgstr "" diff --git a/sale_layout_category_hide_detail/i18n/sale_layout_category_hide_detail.pot b/sale_layout_category_hide_detail/i18n/sale_layout_category_hide_detail.pot new file mode 100644 index 00000000..f83de0f4 --- /dev/null +++ b/sale_layout_category_hide_detail/i18n/sale_layout_category_hide_detail.pot @@ -0,0 +1,81 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_layout_category_hide_detail +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: sale_layout_category_hide_detail +#: model:ir.model,name:sale_layout_category_hide_detail.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model,name:sale_layout_category_hide_detail.model_sale_order_line +msgid "Sales Order Line" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_details +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_details +msgid "Show Details" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_line_amount +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_line_amount +msgid "Show Line Amount" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_section_subtotal +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_section_subtotal +msgid "Show Section Subtotal" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_account_move_line__show_subtotal +#: model:ir.model.fields,field_description:sale_layout_category_hide_detail.field_sale_order_line__show_subtotal +msgid "Show Subtotal" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model_terms:ir.ui.view,arch_db:sale_layout_category_hide_detail.report_saleorder_document_hide_detail +#: model_terms:ir.ui.view,arch_db:sale_layout_category_hide_detail.sale_order_portal_content_hide_detail +msgid "Subtotal" +msgstr "" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Switch to: details hidden" +msgstr "" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Switch to: details shown" +msgstr "" + +#. module: sale_layout_category_hide_detail +#. odoo-javascript +#: code:addons/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js:0 +#, python-format +msgid "Toggle" +msgstr "" + +#. module: sale_layout_category_hide_detail +#: model:ir.model.fields,help:sale_layout_category_hide_detail.field_account_move_line__show_section_subtotal +#: model:ir.model.fields,help:sale_layout_category_hide_detail.field_sale_order_line__show_section_subtotal +msgid "Uncheck this if you want to hide the subtotal on section part" +msgstr "" diff --git a/sale_layout_category_hide_detail/models/__init__.py b/sale_layout_category_hide_detail/models/__init__.py new file mode 100644 index 00000000..10b152aa --- /dev/null +++ b/sale_layout_category_hide_detail/models/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import sale_order +from . import account_move diff --git a/sale_layout_category_hide_detail/models/account_move.py b/sale_layout_category_hide_detail/models/account_move.py new file mode 100644 index 00000000..9a58aa10 --- /dev/null +++ b/sale_layout_category_hide_detail/models/account_move.py @@ -0,0 +1,16 @@ +# Copyright 2018-2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + show_details = fields.Boolean(default=True) + show_subtotal = fields.Boolean(default=True) + show_section_subtotal = fields.Boolean( + default=True, + help="Uncheck this if you want to hide the subtotal on section part", + ) + show_line_amount = fields.Boolean(default=True) diff --git a/sale_layout_category_hide_detail/models/sale_order.py b/sale_layout_category_hide_detail/models/sale_order.py new file mode 100644 index 00000000..721d53fb --- /dev/null +++ b/sale_layout_category_hide_detail/models/sale_order.py @@ -0,0 +1,26 @@ +# Copyright 2018-2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + show_details = fields.Boolean(default=True) + show_section_subtotal = fields.Boolean( + default=True, + help="Uncheck this if you want to hide the subtotal on section part", + ) + show_subtotal = fields.Boolean(default=True) + show_line_amount = fields.Boolean(default=True) + + def _prepare_invoice_line(self, **optional_values): + res = super()._prepare_invoice_line(**optional_values) + res.update( + show_details=self.show_details, + show_subtotal=self.show_subtotal, + show_line_amount=self.show_line_amount, + show_section_subtotal=self.show_section_subtotal, + ) + return res diff --git a/sale_layout_category_hide_detail/pyproject.toml b/sale_layout_category_hide_detail/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/sale_layout_category_hide_detail/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/sale_layout_category_hide_detail/readme/CONTRIBUTORS.md b/sale_layout_category_hide_detail/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..335785d2 --- /dev/null +++ b/sale_layout_category_hide_detail/readme/CONTRIBUTORS.md @@ -0,0 +1,8 @@ +- [Tecnativa](https://www.tecnativa.com): + - Ernesto Tejeda + - Pedro M. Baeza + - Víctor Martínez + - Yadier Quesada +- Denis Roussel \<\> +- Jeroen Evens \<\> +- Tris Doan \<\> diff --git a/sale_layout_category_hide_detail/readme/DESCRIPTION.md b/sale_layout_category_hide_detail/readme/DESCRIPTION.md new file mode 100644 index 00000000..3f5dfd7b --- /dev/null +++ b/sale_layout_category_hide_detail/readme/DESCRIPTION.md @@ -0,0 +1,6 @@ +This module allows you to check/uncheck the new 'Show details' and 'Show +subtotal' flags in *Sale order section lines* and *Customer invoice +section lines* if you want to show or hide their lines or their +subtotals in the PDF report and in the website. You can also show or +hide the section subtotal and line amount by checking or unchecking the +new 'Show section subtotal' and 'Show line amount' flags. diff --git a/sale_layout_category_hide_detail/readme/ROADMAP.md b/sale_layout_category_hide_detail/readme/ROADMAP.md new file mode 100644 index 00000000..eb5a5962 --- /dev/null +++ b/sale_layout_category_hide_detail/readme/ROADMAP.md @@ -0,0 +1,3 @@ +- The boolean_fa_icon widget has not been extracted to a module into + OCA/web because until now this widget has not been needed for anything + else, but it's good that in the future that would be done. diff --git a/sale_layout_category_hide_detail/readme/USAGE.md b/sale_layout_category_hide_detail/readme/USAGE.md new file mode 100644 index 00000000..463a1d9d --- /dev/null +++ b/sale_layout_category_hide_detail/readme/USAGE.md @@ -0,0 +1,12 @@ +The flags on the right hand side of the sale order line allow you to +show or hide details, subtotal, line amount and section subtotal. + +These are the possible combinations: + +![Possible combinations](../static/description/readme-icons/order.png) + +And these are the results in report: + +![Possible combination results in report](../static/description/readme-icons/report.png) + +The behavior described before is the same for Quotations and Invoices. diff --git a/sale_layout_category_hide_detail/static/description/icon.png b/sale_layout_category_hide_detail/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/sale_layout_category_hide_detail/static/description/icon.png differ diff --git a/sale_layout_category_hide_detail/static/description/index.html b/sale_layout_category_hide_detail/static/description/index.html new file mode 100644 index 00000000..56da0958 --- /dev/null +++ b/sale_layout_category_hide_detail/static/description/index.html @@ -0,0 +1,458 @@ + + + + + + +Sale layout category hide detail + + + +
+

Sale layout category hide detail

+ + +

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

+

This module allows you to check/uncheck the new ‘Show details’ and ‘Show +subtotal’ flags in Sale order section lines and Customer invoice +section lines if you want to show or hide their lines or their +subtotals in the PDF report and in the website. You can also show or +hide the section subtotal and line amount by checking or unchecking the +new ‘Show section subtotal’ and ‘Show line amount’ flags.

+

Table of contents

+ +
+

Usage

+

The flags on the right hand side of the sale order line allow you to +show or hide details, subtotal, line amount and section subtotal.

+

These are the possible combinations:

+

Possible combinations

+

And these are the results in report:

+

Possible combination results in report

+

The behavior described before is the same for Quotations and Invoices.

+
+
+

Known issues / Roadmap

+
    +
  • The boolean_fa_icon widget has not been extracted to a module into +OCA/web because until now this widget has not been needed for +anything else, but it’s good that in the future that would be done.
  • +
+
+
+

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

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/sale-reporting project on GitHub.

+

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

+
+
+
+ + diff --git a/sale_layout_category_hide_detail/static/description/readme-icons/eye-slash.png b/sale_layout_category_hide_detail/static/description/readme-icons/eye-slash.png new file mode 100644 index 00000000..310a7a4c Binary files /dev/null and b/sale_layout_category_hide_detail/static/description/readme-icons/eye-slash.png differ diff --git a/sale_layout_category_hide_detail/static/description/readme-icons/eye.png b/sale_layout_category_hide_detail/static/description/readme-icons/eye.png new file mode 100644 index 00000000..7c892be8 Binary files /dev/null and b/sale_layout_category_hide_detail/static/description/readme-icons/eye.png differ diff --git a/sale_layout_category_hide_detail/static/description/readme-icons/minus-circle.png b/sale_layout_category_hide_detail/static/description/readme-icons/minus-circle.png new file mode 100644 index 00000000..ed324cb6 Binary files /dev/null and b/sale_layout_category_hide_detail/static/description/readme-icons/minus-circle.png differ diff --git a/sale_layout_category_hide_detail/static/description/readme-icons/order.png b/sale_layout_category_hide_detail/static/description/readme-icons/order.png new file mode 100644 index 00000000..6cf8beee Binary files /dev/null and b/sale_layout_category_hide_detail/static/description/readme-icons/order.png differ diff --git a/sale_layout_category_hide_detail/static/description/readme-icons/plus-circle.png b/sale_layout_category_hide_detail/static/description/readme-icons/plus-circle.png new file mode 100644 index 00000000..cf7d62cc Binary files /dev/null and b/sale_layout_category_hide_detail/static/description/readme-icons/plus-circle.png differ diff --git a/sale_layout_category_hide_detail/static/description/readme-icons/report.png b/sale_layout_category_hide_detail/static/description/readme-icons/report.png new file mode 100644 index 00000000..f5ed948a Binary files /dev/null and b/sale_layout_category_hide_detail/static/description/readme-icons/report.png differ diff --git a/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js b/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js new file mode 100644 index 00000000..67cb3539 --- /dev/null +++ b/sale_layout_category_hide_detail/static/src/js/boolean_fa_icon_widget.esm.js @@ -0,0 +1,139 @@ +/** @odoo-module **/ +/* Copyright 2019 Tecnativa - Ernesto Tejeda +/* Copyright 2022 Tecnativa - Víctor Martínez +/* Copyright 2023 Tecnativa - Yadier Quesada +/* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).*/ + +const {useState} = owl; +import {BooleanField} from "@web/views/fields/boolean/boolean_field"; +import {_lt, _t} from "@web/core/l10n/translation"; +import {registry} from "@web/core/registry"; + +const iconTrue = "fa-check-square-o"; +const iconFalse = "fa-square-o"; +const tooltipTrue = "Switch to hidden"; +const tooltipFalse = "Switch to show"; + +export class BooleanFaIconWidget extends BooleanField { + setup() { + super.setup(); + const value = this.props.record.data[this.props.name]; + this.state = useState({ + value: value, + fa_class: this.faIconClass(value), + text_tooltip: this.textTooltip(value), + }); + } + // -------------------------------------------------------------------------- + // Public + // -------------------------------------------------------------------------- + faIconClass(currentValue) { + var fa_icons = this.props.fa_icons; + var icon_true = fa_icons.icon_true || iconTrue; + var icon_false = fa_icons.icon_false || iconFalse; + return currentValue ? icon_true : icon_false; + } + // -------------------------------------------------------------------------- + // Public + // -------------------------------------------------------------------------- + textTooltip(currentValue) { + var show_tooltip = this.props.terminology; + var tooltip_true = show_tooltip.hover_true || tooltipTrue; + var tooltip_false = show_tooltip.hover_false || tooltipFalse; + return currentValue ? _lt(tooltip_true) : _lt(tooltip_false); + } + /** + * Check the 'draft' state in sale order or invoices + * Only the order in this state are allowed to edit the value for the widget + * @param {Object} column - The column to render + * @returns {Boolean} + */ + isAllowEdit() { + var resModel = this.props.record.resModel; + var state = this.props.record.data.state; + if (typeof state === "undefined" || state === null) { + state = this.props.record.data.parent_state; + } + if ( + ["account.move.line", "sale.order.line"].includes(resModel) && + state !== "draft" + ) { + this.props.allow = false; + } + return this.props.allow; + } + /** + * @override from BooleanField.isReadonly + * We need to get readonly attribute from field + * and allow to edit inline without the need of focus + */ + get isReadonly() { + return this.props.record._isReadonly(this.props.name); + } + /** + * @returns {Boolean} allow + */ + get allow() { + return this.props.allow; + } + /** + * @returns {String} fa_icons + */ + get fa_icons() { + return this.props.fa_icons; + } + /** + * @returns {String} terminology + */ + get terminology() { + return this.props.terminology; + } + /** + * This method change the value for record, fa-icon class and text for tooltip. + * @event click - triggered when widget element is clicked + */ + onClickButton(ev) { + ev.stopPropagation(); + if (this.isReadonly || !this.isAllowEdit()) { + return; + } + const newValue = !this.state.value; + this.state.value = newValue; + this.props.record.update({[this.props.name]: newValue}); + this.state.fa_class = this.faIconClass(newValue); + this.state.text_tooltip = this.textTooltip(newValue); + } +} +BooleanFaIconWidget.template = "sale_layout_category_hide_detail.BooleanFaIconWidget"; +BooleanFaIconWidget.defaultProps = { + fa_icons: { + icon_true: "fa-check-square-o", + icon_false: "fa-square-o", + }, + terminology: { + hover_true: _lt("Switch to: details hidden"), + hover_false: _lt("Switch to: details shown"), + }, + allow: true, +}; + +BooleanFaIconWidget.props = { + ...BooleanField.props, + fa_icons: {type: Object, optional: true}, + terminology: {type: Object, optional: true}, + allow: {type: Boolean, optional: true}, +}; + +export const booleanFaIconWidget = { + component: BooleanFaIconWidget, + displayName: _t("Toggle"), + supportedTypes: ["boolean"], + extractProps: ({attrs}) => { + return { + fa_icons: JSON.parse(attrs.fa_icons), + terminology: JSON.parse(attrs.terminology), + }; + }, +}; + +registry.category("fields").add("boolean_fa_icon", booleanFaIconWidget); diff --git a/sale_layout_category_hide_detail/static/src/js/sale_layout_category_hide_detail.esm.js b/sale_layout_category_hide_detail/static/src/js/sale_layout_category_hide_detail.esm.js new file mode 100644 index 00000000..5ec18b91 --- /dev/null +++ b/sale_layout_category_hide_detail/static/src/js/sale_layout_category_hide_detail.esm.js @@ -0,0 +1,59 @@ +/** @odoo-module **/ +/* Copyright 2019 Tecnativa - Ernesto Tejeda +/* Copyright 2022 Tecnativa - Víctor Martínez +/* Copyright 2023 Tecnativa - Yadier Quesada +/* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).*/ + +import {SectionAndNoteListRenderer} from "@account/components/section_and_note_fields_backend/section_and_note_fields_backend"; +import {patch} from "@web/core/utils/patch"; + +patch(SectionAndNoteListRenderer.prototype, { + getSectionColumns(columns) { + var sectionCols = super.getSectionColumns(columns); + const widgetCols = columns.filter((col) => col.widget === "boolean_fa_icon"); + const sectionWidget = widgetCols.map((col) => { + return {...col, colspan: 1}; + }); + sectionCols.forEach(function (item) { + if (item.colspan > 1) { + item.colspan -= widgetCols.length; + } + }); + return sectionCols.concat(sectionWidget); + }, + + getCellClass(column, record) { + let classNames = super.getCellClass(column, record); + if (column.widget === "boolean_fa_icon") { + classNames = classNames.replace("o_hidden", ""); + } + return classNames; + }, + + getColumnClass(column) { + if (column.widget === "boolean_fa_icon") { + column.hasLabel = false; + } + return super.getColumnClass(column); + }, + /** + * @override method from ListRenderer.isSortable + * @param {Object} column - The column to render + */ + isSortable(column) { + if (column.widget === "boolean_fa_icon") { + return false; + } + return super.isSortable(column); + }, + /** + * @override method from ListRenderer.calculateColumnWidth + * @param {Object} column - The column to render + */ + calculateColumnWidth(column) { + if (column.widget === "boolean_fa_icon") { + return {type: "absolute", value: "20px"}; + } + return super.calculateColumnWidth(column); + }, +}); diff --git a/sale_layout_category_hide_detail/static/src/xml/boolean_fa_icon_widget.xml b/sale_layout_category_hide_detail/static/src/xml/boolean_fa_icon_widget.xml new file mode 100644 index 00000000..38ad02e8 --- /dev/null +++ b/sale_layout_category_hide_detail/static/src/xml/boolean_fa_icon_widget.xml @@ -0,0 +1,13 @@ + + + + +
+ +
+
+ +
diff --git a/sale_layout_category_hide_detail/tests/__init__.py b/sale_layout_category_hide_detail/tests/__init__.py new file mode 100644 index 00000000..c18f5291 --- /dev/null +++ b/sale_layout_category_hide_detail/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_sale_layout_category_hide_detail diff --git a/sale_layout_category_hide_detail/tests/test_sale_layout_category_hide_detail.py b/sale_layout_category_hide_detail/tests/test_sale_layout_category_hide_detail.py new file mode 100644 index 00000000..f3404849 --- /dev/null +++ b/sale_layout_category_hide_detail/tests/test_sale_layout_category_hide_detail.py @@ -0,0 +1,45 @@ +# Copyright 2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import tagged + +from odoo.addons.sale.tests.common import SaleCommon + + +@tagged("post_install", "-at_install") +class TestSaleLayoutCategoryHideDetail(SaleCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product = cls.env["product.product"].create( + {"name": "Producto test", "type": "consu", "invoice_policy": "order"} + ) + cls.partner = cls.env["res.partner"].create({"name": "partner_test"}) + cls.sale_order = cls.env["sale.order"].create({"partner_id": cls.partner.id}) + cls.so_line = cls.env["sale.order.line"].create( + { + "order_id": cls.sale_order.id, + "product_id": cls.product.id, + "product_uom_qty": 10, + } + ) + cls.sale_order.action_confirm() + + def test_prepare_invoice_line(self): + res = self.so_line._prepare_invoice_line() + self.assertEqual(res["quantity"], 10) + self.assertEqual(res["product_id"], self.product.id) + self.assertEqual(res["show_details"], True) + self.assertEqual(res["show_subtotal"], True) + self.so_line.write({"show_details": False, "show_subtotal": False}) + res = self.so_line._prepare_invoice_line() + self.assertEqual(res["quantity"], 10) + self.assertEqual(res["product_id"], self.product.id) + self.assertEqual(res["show_details"], False) + self.assertEqual(res["show_subtotal"], False) + + def test_create_invoices(self): + self.so_line.write({"show_details": False, "show_subtotal": False}) + invoice = self.sale_order._create_invoices() + self.assertEqual(invoice.invoice_line_ids.show_details, False) + self.assertEqual(invoice.invoice_line_ids.show_subtotal, False) diff --git a/sale_layout_category_hide_detail/views/account_move_view.xml b/sale_layout_category_hide_detail/views/account_move_view.xml new file mode 100644 index 00000000..0198df2e --- /dev/null +++ b/sale_layout_category_hide_detail/views/account_move_view.xml @@ -0,0 +1,107 @@ + + + + + + account.move.form.inherit + account.move + + + + + + + + + + + + + + + + + + col-#{record.display_type.raw_value === 'line_section' ? '8' : 12} + + + + +
+ + + + +
+
+
+ + + + + + + + + + + + + + +
+
+ +
diff --git a/sale_layout_category_hide_detail/views/invoice_report_templates.xml b/sale_layout_category_hide_detail/views/invoice_report_templates.xml new file mode 100644 index 00000000..bcee49db --- /dev/null +++ b/sale_layout_category_hide_detail/views/invoice_report_templates.xml @@ -0,0 +1,92 @@ + + + + + diff --git a/sale_layout_category_hide_detail/views/sale_order_report_templates.xml b/sale_layout_category_hide_detail/views/sale_order_report_templates.xml new file mode 100644 index 00000000..80e7c84d --- /dev/null +++ b/sale_layout_category_hide_detail/views/sale_order_report_templates.xml @@ -0,0 +1,108 @@ + + + + + diff --git a/sale_layout_category_hide_detail/views/sale_portal_templates.xml b/sale_layout_category_hide_detail/views/sale_portal_templates.xml new file mode 100644 index 00000000..b5344d8c --- /dev/null +++ b/sale_layout_category_hide_detail/views/sale_portal_templates.xml @@ -0,0 +1,107 @@ + + + + + diff --git a/sale_layout_category_hide_detail/views/sale_views.xml b/sale_layout_category_hide_detail/views/sale_views.xml new file mode 100644 index 00000000..00b3b179 --- /dev/null +++ b/sale_layout_category_hide_detail/views/sale_views.xml @@ -0,0 +1,101 @@ + + + + + sale.order.hide.detail.form + sale.order + + + + + + + + + + + + + + + + + + + + + + + col-#{record.display_type.raw_value === 'line_section' ? '10' : 12} + + + +
+ + + + +
+
+
+
+
+