diff --git a/pos_receipt_vat_detail/README.rst b/pos_receipt_vat_detail/README.rst new file mode 100644 index 0000000000..5bc74ad2af --- /dev/null +++ b/pos_receipt_vat_detail/README.rst @@ -0,0 +1,98 @@ +========================= +POS Receipt - Vat Details +========================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7572be5ee70835b962c8d22233c3bb508500b0c6922099364ae1e0f48e1a9177 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/16.0/pos_receipt_vat_detail + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_receipt_vat_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/pos&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the Odoo Point of Sale module to explicit +the fiscal information present in the Point of sale Receipt. + +By default, in odoo, there is not the base amount of the vat +displayed on the receipt. + + .. image:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_receipt_vat_detail/static/img/without_module.png + +With this module, the base amount is displayed. It is usefull, +for exemple, if receipt is asked by customer to make an HR expense +because such details can be asked by the accountant. + + .. image:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_receipt_vat_detail/static/img/with_module.png + +The informations are similar to the informations present in the invoice report. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* GRAP + +Contributors +~~~~~~~~~~~~ + +* Sylvain LE GAL + +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-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px + :target: https://github.com/legalsylvain + :alt: legalsylvain + +Current `maintainer `__: + +|maintainer-legalsylvain| + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_receipt_vat_detail/__init__.py b/pos_receipt_vat_detail/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pos_receipt_vat_detail/__manifest__.py b/pos_receipt_vat_detail/__manifest__.py new file mode 100644 index 0000000000..43f480ae4a --- /dev/null +++ b/pos_receipt_vat_detail/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "POS Receipt - Vat Details", + "version": "16.0.1.0.0", + "summary": "Add Vat Details on Receipt (base and vat amounts).", + "author": "GRAP, Odoo Community Association (OCA)", + "maintainers": ["legalsylvain"], + "depends": ["point_of_sale"], + "website": "https://github.com/OCA/pos", + "category": "Point of Sale", + "license": "AGPL-3", + "assets": { + "point_of_sale.assets": [ + "pos_receipt_vat_detail/static/src/js/**/*.js", + "pos_receipt_vat_detail/static/src/xml/**/*.xml", + ], + }, +} diff --git a/pos_receipt_vat_detail/i18n/fr.po b/pos_receipt_vat_detail/i18n/fr.po new file mode 100644 index 0000000000..79a3eb6f8e --- /dev/null +++ b/pos_receipt_vat_detail/i18n/fr.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_receipt_vat_detail +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-07-02 14:30+0000\n" +"PO-Revision-Date: 2024-07-02 14:30+0000\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: pos_receipt_vat_detail +#. odoo-javascript +#: code:addons/pos_receipt_vat_detail/static/src/js/models.js:0 +#, python-format +msgid "Amount" +msgstr "Montant" + +#. module: pos_receipt_vat_detail +#. odoo-javascript +#: code:addons/pos_receipt_vat_detail/static/src/js/models.js:0 +#, python-format +msgid "Base" +msgstr "Base" + +#. module: pos_receipt_vat_detail +#. odoo-javascript +#: code:addons/pos_receipt_vat_detail/static/src/js/models.js:0 +#, python-format +msgid "Over" +msgstr "sur" + +#. module: pos_receipt_vat_detail +#. odoo-javascript +#: code:addons/pos_receipt_vat_detail/static/src/js/models.js:0 +#, python-format +msgid "Tax" +msgstr "Taxe" + +#. module: pos_receipt_vat_detail +#. odoo-javascript +#: code:addons/pos_receipt_vat_detail/static/src/js/models.js:0 +#, python-format +msgid "Total" +msgstr "" diff --git a/pos_receipt_vat_detail/readme/CONTRIBUTORS.rst b/pos_receipt_vat_detail/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..9f76a75bc1 --- /dev/null +++ b/pos_receipt_vat_detail/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Sylvain LE GAL diff --git a/pos_receipt_vat_detail/readme/DESCRIPTION.rst b/pos_receipt_vat_detail/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..96f5e9c2d1 --- /dev/null +++ b/pos_receipt_vat_detail/readme/DESCRIPTION.rst @@ -0,0 +1,15 @@ +This module extends the Odoo Point of Sale module to explicit +the fiscal information present in the Point of sale Receipt. + +By default, in odoo, there is not the base amount of the vat +displayed on the receipt. + + .. image:: ../static/img/without_module.png + +With this module, the base amount is displayed. It is usefull, +for exemple, if receipt is asked by customer to make an HR expense +because such details can be asked by the accountant. + + .. image:: ../static/img/with_module.png + +The informations are similar to the informations present in the invoice report. diff --git a/pos_receipt_vat_detail/static/description/index.html b/pos_receipt_vat_detail/static/description/index.html new file mode 100644 index 0000000000..f97e595782 --- /dev/null +++ b/pos_receipt_vat_detail/static/description/index.html @@ -0,0 +1,438 @@ + + + + + +POS Receipt - Vat Details + + + +
+

POS Receipt - Vat Details

+ + +

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

+

This module extends the Odoo Point of Sale module to explicit +the fiscal information present in the Point of sale Receipt.

+

By default, in odoo, there is not the base amount of the vat +displayed on the receipt.

+
+https://raw.githubusercontent.com/OCA/pos/16.0/pos_receipt_vat_detail/static/img/without_module.png +
+

With this module, the base amount is displayed. It is usefull, +for exemple, if receipt is asked by customer to make an HR expense +because such details can be asked by the accountant.

+
+https://raw.githubusercontent.com/OCA/pos/16.0/pos_receipt_vat_detail/static/img/with_module.png +
+

The informations are similar to the informations present in the invoice report.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • GRAP
  • +
+
+ +
+

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:

+

legalsylvain

+

This module is part of the OCA/pos project on GitHub.

+

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

+
+
+
+ + diff --git a/pos_receipt_vat_detail/static/description/with_module.png b/pos_receipt_vat_detail/static/description/with_module.png new file mode 100644 index 0000000000..9ea6546246 Binary files /dev/null and b/pos_receipt_vat_detail/static/description/with_module.png differ diff --git a/pos_receipt_vat_detail/static/description/without_module.png b/pos_receipt_vat_detail/static/description/without_module.png new file mode 100644 index 0000000000..ed8f995073 Binary files /dev/null and b/pos_receipt_vat_detail/static/description/without_module.png differ diff --git a/pos_receipt_vat_detail/static/src/js/models.js b/pos_receipt_vat_detail/static/src/js/models.js new file mode 100644 index 0000000000..4a630ffd8a --- /dev/null +++ b/pos_receipt_vat_detail/static/src/js/models.js @@ -0,0 +1,90 @@ +odoo.define("pos_receipt_vat_detail.models", function (require) { + "use strict"; + + const {Order} = require("point_of_sale.models"); + const Registries = require("point_of_sale.Registries"); + + var core = require("web.core"); + var _t = core._t; + + const OverloadOrder = (OriginalOrder) => + class extends OriginalOrder { + /** + * * Detailed values for tax lines. + * @returns {dict} List of taxes description. + */ + get_tax_details_with_base() { + var self = this; + var tax_dict = {}; + var tax_total = 0.0; + var base_total = 0.0; + var tax_details = [ + { + base_text: _t("Base"), + amount_text: _t("Amount"), + }, + ]; + _.each(this.get_orderlines(), function (line) { + var line_detail = line.get_all_prices(); + for (var id in line_detail.taxDetails) { + var tax = self.pos.taxes_by_id[id]; + if (tax.amount in tax_dict) { + tax_dict[tax.amount].tax_amount += line_detail.tax; + tax_dict[tax.amount].base_amount += + line_detail.priceWithoutTax; + } else { + tax_dict[tax.amount] = { + tax_amount: line_detail.tax, + base_amount: line_detail.priceWithoutTax, + }; + } + } + // Handle case where there is no tax + if (line_detail.tax === 0 && line_detail.priceWithTax !== 0) { + if (0.0 in tax_dict) { + tax_dict[0.0].tax_amount += 0.0; + tax_dict[0.0].base_amount += line_detail.priceWithoutTax; + } else { + tax_dict[0.0] = { + tax_amount: 0.0, + base_amount: line_detail.priceWithoutTax, + }; + } + } + }); + $.each(tax_dict, function (key, value) { + tax_total += value.tax_amount; + base_total += value.base_amount; + tax_details.push({ + base_text: + _t("Tax") + + " " + + String(key) + + " % " + + _t("Over") + + " " + + self.pos.format_currency(value.base_amount), + amount_text: self.pos.format_currency(value.tax_amount), + }); + }); + if (tax_details.length > 2) { + tax_details.push({ + base_text: + _t("Total") + " " + self.pos.format_currency(base_total), + amount_text: self.pos.format_currency(tax_total), + }); + } + return tax_details; + } + + export_for_printing() { + var receipt = super.export_for_printing(...arguments); + receipt.tax_details_with_base = this.get_tax_details_with_base(); + return receipt; + } + }; + + Registries.Model.extend(Order, OverloadOrder); + + return Order; +}); diff --git a/pos_receipt_vat_detail/static/src/xml/order_receipt.xml b/pos_receipt_vat_detail/static/src/xml/order_receipt.xml new file mode 100644 index 0000000000..dd3885688b --- /dev/null +++ b/pos_receipt_vat_detail/static/src/xml/order_receipt.xml @@ -0,0 +1,32 @@ + + + + + + + + + + +
+ + + + + + +
+
+ +
+ +
+
diff --git a/setup/pos_receipt_vat_detail/odoo/addons/pos_receipt_vat_detail b/setup/pos_receipt_vat_detail/odoo/addons/pos_receipt_vat_detail new file mode 120000 index 0000000000..228afbefdc --- /dev/null +++ b/setup/pos_receipt_vat_detail/odoo/addons/pos_receipt_vat_detail @@ -0,0 +1 @@ +../../../../pos_receipt_vat_detail \ No newline at end of file diff --git a/setup/pos_receipt_vat_detail/setup.py b/setup/pos_receipt_vat_detail/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/pos_receipt_vat_detail/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)