From c2c4f6fd89820afd2200459cbbef3ea922f9d54f Mon Sep 17 00:00:00 2001 From: Aung Ko Ko Lin Date: Tue, 20 Dec 2022 15:27:35 +0630 Subject: [PATCH 1/4] [ADD] report_qweb_decimal_place --- report_qweb_decimal_place/README.rst | 88 ++++ report_qweb_decimal_place/__init__.py | 1 + report_qweb_decimal_place/__manifest__.py | 16 + report_qweb_decimal_place/models/__init__.py | 1 + .../models/res_currency.py | 16 + .../readme/CONFIGURE.rst | 6 + .../readme/DESCRIPTION.rst | 27 ++ .../reports/price_unit_value_format.xml | 15 + .../static/description/index.html | 445 ++++++++++++++++++ .../views/res_currency_views.xml | 17 + .../odoo/addons/report_qweb_decimal_place | 1 + setup/report_qweb_decimal_place/setup.py | 6 + 12 files changed, 639 insertions(+) create mode 100644 report_qweb_decimal_place/README.rst create mode 100644 report_qweb_decimal_place/__init__.py create mode 100644 report_qweb_decimal_place/__manifest__.py create mode 100644 report_qweb_decimal_place/models/__init__.py create mode 100644 report_qweb_decimal_place/models/res_currency.py create mode 100644 report_qweb_decimal_place/readme/CONFIGURE.rst create mode 100644 report_qweb_decimal_place/readme/DESCRIPTION.rst create mode 100644 report_qweb_decimal_place/reports/price_unit_value_format.xml create mode 100644 report_qweb_decimal_place/static/description/index.html create mode 100644 report_qweb_decimal_place/views/res_currency_views.xml create mode 120000 setup/report_qweb_decimal_place/odoo/addons/report_qweb_decimal_place create mode 100644 setup/report_qweb_decimal_place/setup.py diff --git a/report_qweb_decimal_place/README.rst b/report_qweb_decimal_place/README.rst new file mode 100644 index 0000000..4549e23 --- /dev/null +++ b/report_qweb_decimal_place/README.rst @@ -0,0 +1,88 @@ +========================= +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-qrtl%2Ffsb--custom-lightgray.png?logo=github + :target: https://github.com/qrtl/fsb-custom/tree/16.0/report_qweb_decimal_place + :alt: qrtl/fsb-custom + +|badge1| |badge2| |badge3| + +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 part of the `qrtl/fsb-custom `_ project on GitHub. + +You are welcome to contribute. diff --git a/report_qweb_decimal_place/__init__.py b/report_qweb_decimal_place/__init__.py new file mode 100644 index 0000000..0650744 --- /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 0000000..3c5627e --- /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": "16.0.1.0.0", + "author": "Quartile Limited", + "website": "https://www.quartile.co", + "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/models/__init__.py b/report_qweb_decimal_place/models/__init__.py new file mode 100644 index 0000000..ea5a680 --- /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 0000000..2441e89 --- /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 0000000..8183e4a --- /dev/null +++ b/report_qweb_decimal_place/readme/CONFIGURE.rst @@ -0,0 +1,6 @@ +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 0000000..4036041 --- /dev/null +++ b/report_qweb_decimal_place/readme/DESCRIPTION.rst @@ -0,0 +1,27 @@ +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 0000000..f6589d0 --- /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/index.html b/report_qweb_decimal_place/static/description/index.html new file mode 100644 index 0000000..85b1c1f --- /dev/null +++ b/report_qweb_decimal_place/static/description/index.html @@ -0,0 +1,445 @@ + + + + + + +Report Qweb Decimal Place + + + +
+

Report Qweb Decimal Place

+ + +

Beta License: LGPL-3 qrtl/fsb-custom

+

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:
+
    +
  • 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 part of the qrtl/fsb-custom project on GitHub.

+

You are welcome to 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 0000000..cba49df --- /dev/null +++ b/report_qweb_decimal_place/views/res_currency_views.xml @@ -0,0 +1,17 @@ + + + + res.currency + res.currency + + + + + + + + + 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 0000000..73d2a48 --- /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 0000000..28c57bb --- /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, +) From 0ad6792a1a71d6cdd265875c3284f541ceb0301f Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Wed, 4 Jan 2023 08:14:36 +0630 Subject: [PATCH 2/4] [FIX] readme template --- report_qweb_decimal_place/README.rst | 14 ++++++------ .../readme/DESCRIPTION.rst | 2 +- .../static/description/index.html | 22 ++++++++----------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/report_qweb_decimal_place/README.rst b/report_qweb_decimal_place/README.rst index 4549e23..5f03b70 100644 --- a/report_qweb_decimal_place/README.rst +++ b/report_qweb_decimal_place/README.rst @@ -13,9 +13,9 @@ Report Qweb Decimal Place .. |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-qrtl%2Ffsb--custom-lightgray.png?logo=github - :target: https://github.com/qrtl/fsb-custom/tree/16.0/report_qweb_decimal_place - :alt: qrtl/fsb-custom +.. |badge3| image:: https://img.shields.io/badge/github-qrtl%2Ffal--custom-lightgray.png?logo=github + :target: https://github.com/qrtl/fal-custom/tree/16.0/report_qweb_decimal_place + :alt: qrtl/fal-custom |badge1| |badge2| |badge3| @@ -38,7 +38,7 @@ Individual adjustments need to be done in separate modules in a manner similar t 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. @@ -65,10 +65,10 @@ Inherit this module in your xxx_report_qweb_decimal_place module and format the Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -83,6 +83,6 @@ Authors Maintainers ~~~~~~~~~~~ -This module is part of the `qrtl/fsb-custom `_ project on GitHub. +This module is part of the `qrtl/fal-custom `_ project on GitHub. You are welcome to contribute. diff --git a/report_qweb_decimal_place/readme/DESCRIPTION.rst b/report_qweb_decimal_place/readme/DESCRIPTION.rst index 4036041..cef1064 100644 --- a/report_qweb_decimal_place/readme/DESCRIPTION.rst +++ b/report_qweb_decimal_place/readme/DESCRIPTION.rst @@ -17,7 +17,7 @@ Individual adjustments need to be done in separate modules in a manner similar t 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. diff --git a/report_qweb_decimal_place/static/description/index.html b/report_qweb_decimal_place/static/description/index.html index 85b1c1f..c5d2517 100644 --- a/report_qweb_decimal_place/static/description/index.html +++ b/report_qweb_decimal_place/static/description/index.html @@ -367,7 +367,7 @@

Report Qweb Decimal Place

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 qrtl/fsb-custom

+

Beta License: LGPL-3 qrtl/fal-custom

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. @@ -397,11 +397,7 @@

Background:

@@ -419,27 +415,27 @@

Configuration

Bug Tracker

-

Bugs are tracked on GitHub Issues. +

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.

+feedback.

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

+
-

Authors

+

Authors

  • Quartile Limited
-

Maintainers

-

This module is part of the qrtl/fsb-custom project on GitHub.

+

Maintainers

+

This module is part of the qrtl/fal-custom project on GitHub.

You are welcome to contribute.

- - From e2947655b07d8b2520df2ae17bc48fa6fde79f8e Mon Sep 17 00:00:00 2001 From: Aung Ko Ko Lin Date: Wed, 4 Jan 2023 09:33:13 +0630 Subject: [PATCH 3/4] update readme --- report_qweb_decimal_place/README.rst | 1 + report_qweb_decimal_place/readme/DESCRIPTION.rst | 1 + 2 files changed, 2 insertions(+) diff --git a/report_qweb_decimal_place/README.rst b/report_qweb_decimal_place/README.rst index 5f03b70..2329db8 100644 --- a/report_qweb_decimal_place/README.rst +++ b/report_qweb_decimal_place/README.rst @@ -39,6 +39,7 @@ Individual adjustments need to be done in separate modules in a manner similar t 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. diff --git a/report_qweb_decimal_place/readme/DESCRIPTION.rst b/report_qweb_decimal_place/readme/DESCRIPTION.rst index cef1064..81cd0c0 100644 --- a/report_qweb_decimal_place/readme/DESCRIPTION.rst +++ b/report_qweb_decimal_place/readme/DESCRIPTION.rst @@ -18,6 +18,7 @@ Individual adjustments need to be done in separate modules in a manner similar t 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. From bce7e57c8942762cc2d50dba1bad657b15ad2a56 Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Wed, 4 Jan 2023 14:32:42 +0630 Subject: [PATCH 4/4] update readme --- report_qweb_decimal_place/README.rst | 7 ++++--- report_qweb_decimal_place/readme/CONFIGURE.rst | 7 ++++--- report_qweb_decimal_place/static/description/index.html | 9 +++------ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/report_qweb_decimal_place/README.rst b/report_qweb_decimal_place/README.rst index 2329db8..a71f8fc 100644 --- a/report_qweb_decimal_place/README.rst +++ b/report_qweb_decimal_place/README.rst @@ -57,9 +57,10 @@ 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 + +#. 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/CONFIGURE.rst b/report_qweb_decimal_place/readme/CONFIGURE.rst index 8183e4a..5cf0072 100644 --- a/report_qweb_decimal_place/readme/CONFIGURE.rst +++ b/report_qweb_decimal_place/readme/CONFIGURE.rst @@ -1,6 +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 + +#. 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/static/description/index.html b/report_qweb_decimal_place/static/description/index.html index c5d2517..d4ef08e 100644 --- a/report_qweb_decimal_place/static/description/index.html +++ b/report_qweb_decimal_place/static/description/index.html @@ -402,15 +402,12 @@

Background:

Configuration

-
-
To apply price unit format:
-
    +

    To apply price unit format:

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

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