diff --git a/README.md b/README.md index 41dbfc2ecf..1077b29708 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ addon | version | maintainers | summary [report_async](report_async/) | 15.0.1.0.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Central place to run reports live or async [report_csv](report_csv/) | 15.0.1.0.0 | | Base module to create csv report [report_qr](report_qr/) | 15.0.1.0.0 | | Web QR Manager +[report_qweb_decimal_place](report_qweb_decimal_place/) | 15.0.1.0.0 | | Report Qweb Decimal Place [report_qweb_element_page_visibility](report_qweb_element_page_visibility/) | 15.0.1.0.2 | | Report Qweb Element Page Visibility [report_qweb_encrypt](report_qweb_encrypt/) | 15.0.1.0.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Allow to encrypt qweb pdfs [report_qweb_parameter](report_qweb_parameter/) | 15.0.1.0.0 | | Add new parameters for qweb templates in order to reduce field length and check minimal length diff --git a/report_qweb_decimal_place/README.rst b/report_qweb_decimal_place/README.rst new file mode 100644 index 0000000000..140d28fa24 --- /dev/null +++ b/report_qweb_decimal_place/README.rst @@ -0,0 +1,106 @@ +========================= +Report Qweb Decimal Place +========================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github + :target: https://github.com/OCA/reporting-engine/tree/15.0/report_qweb_decimal_place + :alt: OCA/reporting-engine +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-report_qweb_decimal_place + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/143/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module intends to provide the base function for currencies to adjust the number of decimal places +for the unit price in QWeb reports. +Installing this module alone does not affect the presentation of existing QWeb reports. +Individual adjustments need to be done in separate modules in a manner similar to the following: + +.. code-block:: xml + + + +Background: +~~~~~~~~~~~ + +Odoo default reports display price unit with the decimal accuracy of product price configuration. +However, globally applying the decimal accuracy setting is sometimes not appropriate under multi-currency settings +where how unit prices should be presented differs depending on the currency. + +For example, unit prices in JPY usually do not have decimals (with some exceptions depending on the industry), +while those in USD may require up to 2-4 decimals. If we configure the decimal accuracy based on USD, the unit price +presentation on PDF reports for JPY transactions may appear a bit unconventional. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To apply price unit format: + +#. Go to Invoicing --> Configuration --> Currencies +#. Check apply_price_decimal_place field +#. Define decimal place in price_decimal_place field + +Inherit this module in your xxx_report_qweb_decimal_place module and format the price unit in reports. + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Quartile Limited + +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/reporting-engine `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/report_qweb_decimal_place/__init__.py b/report_qweb_decimal_place/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/report_qweb_decimal_place/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/report_qweb_decimal_place/__manifest__.py b/report_qweb_decimal_place/__manifest__.py new file mode 100644 index 0000000000..47e96a1421 --- /dev/null +++ b/report_qweb_decimal_place/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2022 Quartile Limited +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +{ + "name": "Report Qweb Decimal Place", + "category": "Reporting", + "version": "15.0.1.0.0", + "author": "Quartile Limited, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/reporting-engine", + "license": "LGPL-3", + "depends": ["base"], + "data": [ + "reports/price_unit_value_format.xml", + "views/res_currency_views.xml", + ], + "installable": True, +} diff --git a/report_qweb_decimal_place/i18n/report_qweb_decimal_place.pot b/report_qweb_decimal_place/i18n/report_qweb_decimal_place.pot new file mode 100644 index 0000000000..f2f9440592 --- /dev/null +++ b/report_qweb_decimal_place/i18n/report_qweb_decimal_place.pot @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_decimal_place +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.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: report_qweb_decimal_place +#: model:ir.model.fields,field_description:report_qweb_decimal_place.field_res_currency__apply_price_decimal_place +msgid "Apply Price Decimal Place" +msgstr "" + +#. module: report_qweb_decimal_place +#: model:ir.model.fields,help:report_qweb_decimal_place.field_res_currency__apply_price_decimal_place +msgid "" +"Apply this decimal place to the unit price field of relevant PDF reports " +"where appropriate customization is done." +msgstr "" + +#. module: report_qweb_decimal_place +#: model:ir.model,name:report_qweb_decimal_place.model_res_currency +msgid "Currency" +msgstr "" + +#. module: report_qweb_decimal_place +#: model:ir.model.fields,help:report_qweb_decimal_place.field_res_currency__price_decimal_places +msgid "Define decimal places for the unit price field of relevant PDF reports" +msgstr "" + +#. module: report_qweb_decimal_place +#: model:ir.model.fields,field_description:report_qweb_decimal_place.field_res_currency__price_decimal_places +msgid "Price Decimal Places" +msgstr "" diff --git a/report_qweb_decimal_place/models/__init__.py b/report_qweb_decimal_place/models/__init__.py new file mode 100644 index 0000000000..ea5a680ddc --- /dev/null +++ b/report_qweb_decimal_place/models/__init__.py @@ -0,0 +1 @@ +from . import res_currency diff --git a/report_qweb_decimal_place/models/res_currency.py b/report_qweb_decimal_place/models/res_currency.py new file mode 100644 index 0000000000..2441e895fc --- /dev/null +++ b/report_qweb_decimal_place/models/res_currency.py @@ -0,0 +1,16 @@ +# Copyright 2022 Quartile Limited +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from odoo import fields, models + + +class ResCurrency(models.Model): + _inherit = "res.currency" + + apply_price_decimal_place = fields.Boolean( + help="Apply this decimal place to the unit price field of relevant PDF reports " + "where appropriate customization is done." + ) + price_decimal_places = fields.Integer( + help="Define decimal places for the unit price field of relevant PDF reports" + ) diff --git a/report_qweb_decimal_place/readme/CONFIGURE.rst b/report_qweb_decimal_place/readme/CONFIGURE.rst new file mode 100644 index 0000000000..5cf0072411 --- /dev/null +++ b/report_qweb_decimal_place/readme/CONFIGURE.rst @@ -0,0 +1,7 @@ +To apply price unit format: + +#. Go to Invoicing --> Configuration --> Currencies +#. Check apply_price_decimal_place field +#. Define decimal place in price_decimal_place field + +Inherit this module in your xxx_report_qweb_decimal_place module and format the price unit in reports. diff --git a/report_qweb_decimal_place/readme/DESCRIPTION.rst b/report_qweb_decimal_place/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..81cd0c00f3 --- /dev/null +++ b/report_qweb_decimal_place/readme/DESCRIPTION.rst @@ -0,0 +1,28 @@ +This module intends to provide the base function for currencies to adjust the number of decimal places +for the unit price in QWeb reports. +Installing this module alone does not affect the presentation of existing QWeb reports. +Individual adjustments need to be done in separate modules in a manner similar to the following: + +.. code-block:: xml + + + +Background: +~~~~~~~~~~~ + +Odoo default reports display price unit with the decimal accuracy of product price configuration. +However, globally applying the decimal accuracy setting is sometimes not appropriate under multi-currency settings +where how unit prices should be presented differs depending on the currency. + +For example, unit prices in JPY usually do not have decimals (with some exceptions depending on the industry), +while those in USD may require up to 2-4 decimals. If we configure the decimal accuracy based on USD, the unit price +presentation on PDF reports for JPY transactions may appear a bit unconventional. diff --git a/report_qweb_decimal_place/reports/price_unit_value_format.xml b/report_qweb_decimal_place/reports/price_unit_value_format.xml new file mode 100644 index 0000000000..f6589d0407 --- /dev/null +++ b/report_qweb_decimal_place/reports/price_unit_value_format.xml @@ -0,0 +1,15 @@ + + + + diff --git a/report_qweb_decimal_place/static/description/icon.png b/report_qweb_decimal_place/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/report_qweb_decimal_place/static/description/icon.png differ diff --git a/report_qweb_decimal_place/static/description/index.html b/report_qweb_decimal_place/static/description/index.html new file mode 100644 index 0000000000..8af5d81bee --- /dev/null +++ b/report_qweb_decimal_place/static/description/index.html @@ -0,0 +1,443 @@ + + + + + + +Report Qweb Decimal Place + + + +
+

Report Qweb Decimal Place

+ + +

Beta License: LGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runbot

+

This module intends to provide the base function for currencies to adjust the number of decimal places +for the unit price in QWeb reports. +Installing this module alone does not affect the presentation of existing QWeb reports. +Individual adjustments need to be done in separate modules in a manner similar to the following:

+
+<template
+    id="report_saleorder_document_inherit"
+    inherit_id="sale.report_saleorder_document"
+>
+    <xpath expr="//td[@name='td_priceunit']/span" position="replace">
+            <t t-set="currency" t-value="doc.currency_id" />
+            <t t-set="price_unit" t-value="line.price_unit" />
+            <t t-call="report_qweb_decimal_place.price_unit_value_format" />
+    </xpath>
+</template>
+
+
+

Background:

+

Odoo default reports display price unit with the decimal accuracy of product price configuration. +However, globally applying the decimal accuracy setting is sometimes not appropriate under multi-currency settings +where how unit prices should be presented differs depending on the currency.

+

For example, unit prices in JPY usually do not have decimals (with some exceptions depending on the industry), +while those in USD may require up to 2-4 decimals. If we configure the decimal accuracy based on USD, the unit price +presentation on PDF reports for JPY transactions may appear a bit unconventional.

+

Table of contents

+ +
+

Configuration

+

To apply price unit format:

+
    +
  1. Go to Invoicing –> Configuration –> Currencies
  2. +
  3. Check apply_price_decimal_place field
  4. +
  5. Define decimal place in price_decimal_place field
  6. +
+

Inherit this module in your xxx_report_qweb_decimal_place module and format the price unit in reports.

+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+ +
+
+

Authors

+
    +
  • Quartile Limited
  • +
+
+
+

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

+

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

+
+
+ + diff --git a/report_qweb_decimal_place/views/res_currency_views.xml b/report_qweb_decimal_place/views/res_currency_views.xml new file mode 100644 index 0000000000..cba49dfae1 --- /dev/null +++ b/report_qweb_decimal_place/views/res_currency_views.xml @@ -0,0 +1,17 @@ + + + + res.currency + res.currency + + + + + + + + + diff --git a/setup/_metapackage/VERSION.txt b/setup/_metapackage/VERSION.txt index 7f87840d79..799ea336bb 100644 --- a/setup/_metapackage/VERSION.txt +++ b/setup/_metapackage/VERSION.txt @@ -1 +1 @@ -15.0.20230318.3 \ No newline at end of file +15.0.20230714.0 \ No newline at end of file diff --git a/setup/_metapackage/setup.py b/setup/_metapackage/setup.py index 1ad62f07da..a7901d0508 100644 --- a/setup/_metapackage/setup.py +++ b/setup/_metapackage/setup.py @@ -15,6 +15,7 @@ 'odoo-addon-report_async>=15.0dev,<15.1dev', 'odoo-addon-report_csv>=15.0dev,<15.1dev', 'odoo-addon-report_qr>=15.0dev,<15.1dev', + 'odoo-addon-report_qweb_decimal_place>=15.0dev,<15.1dev', 'odoo-addon-report_qweb_element_page_visibility>=15.0dev,<15.1dev', 'odoo-addon-report_qweb_encrypt>=15.0dev,<15.1dev', 'odoo-addon-report_qweb_parameter>=15.0dev,<15.1dev', diff --git a/setup/report_qweb_decimal_place/odoo/addons/report_qweb_decimal_place b/setup/report_qweb_decimal_place/odoo/addons/report_qweb_decimal_place new file mode 120000 index 0000000000..73d2a4829c --- /dev/null +++ b/setup/report_qweb_decimal_place/odoo/addons/report_qweb_decimal_place @@ -0,0 +1 @@ +../../../../report_qweb_decimal_place \ No newline at end of file diff --git a/setup/report_qweb_decimal_place/setup.py b/setup/report_qweb_decimal_place/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/report_qweb_decimal_place/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)