diff --git a/l10n_ch_qr_no_amount/README.rst b/l10n_ch_qr_no_amount/README.rst new file mode 100644 index 000000000..46846c6b9 --- /dev/null +++ b/l10n_ch_qr_no_amount/README.rst @@ -0,0 +1,101 @@ +=============================== +Switzerland - No Amount QR-bill +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e790e1b2f6aeeeb045f9405a93cd90d9602df5da116a09a9bed3a4b571224472 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |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%2Fl10n--switzerland-lightgray.png?logo=github + :target: https://github.com/OCA/l10n-switzerland/tree/16.0/l10n_ch_qr_no_amount + :alt: OCA/l10n-switzerland +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/l10n-switzerland-16-0/l10n-switzerland-16-0-l10n_ch_qr_no_amount + :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/l10n-switzerland&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +| This module adds a new report that allows to print QR bills without + any amount, +| so that the customer can define himself the amount to pay. + +Not setting the amount allows to use the same QR code for multiple +payments referencing the same invoice. + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Add the report to the print action and use it as you wish. + +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 +------- + +* Camptocamp + +Contributors +------------ + +- Akim Juillerat +- Son Ho +- Telmo Santos + +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-grindtildeath| image:: https://github.com/grindtildeath.png?size=40px + :target: https://github.com/grindtildeath + :alt: grindtildeath + +Current `maintainer `__: + +|maintainer-grindtildeath| + +This module is part of the `OCA/l10n-switzerland `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_ch_qr_no_amount/__init__.py b/l10n_ch_qr_no_amount/__init__.py new file mode 100644 index 000000000..bf588bc8b --- /dev/null +++ b/l10n_ch_qr_no_amount/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import report diff --git a/l10n_ch_qr_no_amount/__manifest__.py b/l10n_ch_qr_no_amount/__manifest__.py new file mode 100644 index 000000000..02ded1283 --- /dev/null +++ b/l10n_ch_qr_no_amount/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +{ + "name": "Switzerland - No Amount QR-bill", + "summary": "Allow to print QR bill without amount", + "version": "16.0.1.0.0", + "development_status": "Alpha", + "category": "Localization", + "website": "https://github.com/OCA/l10n-switzerland", + "author": "Camptocamp, Odoo Community Association (OCA)", + "maintainers": ["grindtildeath"], + "license": "AGPL-3", + "installable": True, + "depends": ["l10n_ch"], + "data": ["report/swissqr_no_amount_report.xml"], + "assets": { + "web.report_assets_common": [ + "l10n_ch_qr_no_amount/static/src/scss/report_swissqr_no_amount.scss", + ], + }, +} diff --git a/l10n_ch_qr_no_amount/i18n/l10n_ch_qr_no_amount.pot b/l10n_ch_qr_no_amount/i18n/l10n_ch_qr_no_amount.pot new file mode 100644 index 000000000..1469ed20a --- /dev/null +++ b/l10n_ch_qr_no_amount/i18n/l10n_ch_qr_no_amount.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_ch_qr_no_amount +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_ch_qr_no_amount +#: model:ir.actions.report,print_report_name:l10n_ch_qr_no_amount.l10n_ch_qr_no_amount_report +msgid "'QR-bill-%s' % object.name" +msgstr "" + +#. module: l10n_ch_qr_no_amount +#: model:ir.model,name:l10n_ch_qr_no_amount.model_res_partner_bank +msgid "Bank Accounts" +msgstr "" + +#. module: l10n_ch_qr_no_amount +#: model:ir.actions.report,name:l10n_ch_qr_no_amount.l10n_ch_qr_no_amount_report +#: model:ir.model,name:l10n_ch_qr_no_amount.model_report_l10n_ch_qr_no_amount_qr_no_amount_report_main +msgid "QR-No-Amount-bill" +msgstr "" diff --git a/l10n_ch_qr_no_amount/models/__init__.py b/l10n_ch_qr_no_amount/models/__init__.py new file mode 100644 index 000000000..7ff1ea226 --- /dev/null +++ b/l10n_ch_qr_no_amount/models/__init__.py @@ -0,0 +1 @@ +from . import res_partner_bank diff --git a/l10n_ch_qr_no_amount/models/res_partner_bank.py b/l10n_ch_qr_no_amount/models/res_partner_bank.py new file mode 100644 index 000000000..1ec6ddcdf --- /dev/null +++ b/l10n_ch_qr_no_amount/models/res_partner_bank.py @@ -0,0 +1,31 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from odoo import models + + +class ResPartnerBank(models.Model): + _inherit = "res.partner.bank" + + def _l10n_ch_get_qr_vals( + self, + amount, + currency_name, + debtor_partner, + free_communication, + structured_communication, + ): + res = super()._l10n_ch_get_qr_vals( + amount, + currency_name, + debtor_partner, + free_communication, + structured_communication, + ) + if self.env.context.get("_no_amount_qr_code", False): + res = self._remove_swiss_code_amount(res) + return res + + def _remove_swiss_code_amount(self, values_list): + # 18 is the position of amount in returned list + values_list[18] = "" + return values_list diff --git a/l10n_ch_qr_no_amount/pyproject.toml b/l10n_ch_qr_no_amount/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/l10n_ch_qr_no_amount/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/l10n_ch_qr_no_amount/readme/CONTRIBUTORS.md b/l10n_ch_qr_no_amount/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..9693342b8 --- /dev/null +++ b/l10n_ch_qr_no_amount/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- Akim Juillerat \<\> +- Son Ho \<\> +- Telmo Santos \<\> \ No newline at end of file diff --git a/l10n_ch_qr_no_amount/readme/DESCRIPTION.md b/l10n_ch_qr_no_amount/readme/DESCRIPTION.md new file mode 100644 index 000000000..e0007ad07 --- /dev/null +++ b/l10n_ch_qr_no_amount/readme/DESCRIPTION.md @@ -0,0 +1,5 @@ +This module adds a new report that allows to print QR bills without any amount, +so that the customer can define himself the amount to pay. + +Not setting the amount allows to use the same QR code for multiple +payments referencing the same invoice. diff --git a/l10n_ch_qr_no_amount/readme/USAGE.md b/l10n_ch_qr_no_amount/readme/USAGE.md new file mode 100644 index 000000000..5a1138574 --- /dev/null +++ b/l10n_ch_qr_no_amount/readme/USAGE.md @@ -0,0 +1 @@ +Add the report to the print action and use it as you wish. diff --git a/l10n_ch_qr_no_amount/report/__init__.py b/l10n_ch_qr_no_amount/report/__init__.py new file mode 100644 index 000000000..f795edb8c --- /dev/null +++ b/l10n_ch_qr_no_amount/report/__init__.py @@ -0,0 +1 @@ +from . import swissqr_no_amount_report diff --git a/l10n_ch_qr_no_amount/report/swissqr_no_amount_report.py b/l10n_ch_qr_no_amount/report/swissqr_no_amount_report.py new file mode 100644 index 000000000..f07d0df98 --- /dev/null +++ b/l10n_ch_qr_no_amount/report/swissqr_no_amount_report.py @@ -0,0 +1,13 @@ +from odoo import api, models + + +class ReportSwissNoAmountQR(models.AbstractModel): + _name = "report.l10n_ch_qr_no_amount.qr_no_amount_report_main" + _inherit = "report.l10n_ch.qr_report_main" + _description = "QR-No-Amount-bill" + + @api.model + def _get_report_values(self, docids, data=None): + if self._name == "report.l10n_ch_qr_no_amount.qr_no_amount_report_main": + self = self.with_context(_no_amount_qr_code=True) + return super(ReportSwissNoAmountQR, self)._get_report_values(docids, data) diff --git a/l10n_ch_qr_no_amount/report/swissqr_no_amount_report.xml b/l10n_ch_qr_no_amount/report/swissqr_no_amount_report.xml new file mode 100644 index 000000000..2e2e16f3c --- /dev/null +++ b/l10n_ch_qr_no_amount/report/swissqr_no_amount_report.xml @@ -0,0 +1,74 @@ + + + + + QR-No-Amount-bill + account.move + qweb-pdf + l10n_ch_qr_no_amount.qr_no_amount_report_main + l10n_ch_qr_no_amount.qr_report_main + 'QR-bill-' + object.name + '.pdf' + 'QR-bill-%s' % object.name + + + + + + + + diff --git a/l10n_ch_qr_no_amount/static/description/icon.png b/l10n_ch_qr_no_amount/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/l10n_ch_qr_no_amount/static/description/icon.png differ diff --git a/l10n_ch_qr_no_amount/static/description/index.html b/l10n_ch_qr_no_amount/static/description/index.html new file mode 100644 index 000000000..26c92679c --- /dev/null +++ b/l10n_ch_qr_no_amount/static/description/index.html @@ -0,0 +1,446 @@ + + + + + +Switzerland - No Amount QR-bill + + + +
+

Switzerland - No Amount QR-bill

+ + +

Alpha License: AGPL-3 OCA/l10n-switzerland Translate me on Weblate Try me on Runboat

+
+
This module adds a new report that allows to print QR bills without +any amount,
+
so that the customer can define himself the amount to pay.
+
+

Not setting the amount allows to use the same QR code for multiple +payments referencing the same invoice.

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Usage

+

Add the report to the print action and use it as you wish.

+
+
+

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

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The migration of this module from 13.0 to 17.0 was financially supported +by Camptocamp

+
+
+

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:

+

grindtildeath

+

This module is part of the OCA/l10n-switzerland project on GitHub.

+

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

+
+
+
+ + diff --git a/l10n_ch_qr_no_amount/static/src/img/Betragsfeld_Eckmarke.png b/l10n_ch_qr_no_amount/static/src/img/Betragsfeld_Eckmarke.png new file mode 100644 index 000000000..10001c344 Binary files /dev/null and b/l10n_ch_qr_no_amount/static/src/img/Betragsfeld_Eckmarke.png differ diff --git a/l10n_ch_qr_no_amount/static/src/img/Feld_Betrag_40x15mm.png b/l10n_ch_qr_no_amount/static/src/img/Feld_Betrag_40x15mm.png new file mode 100644 index 000000000..87b8384e1 Binary files /dev/null and b/l10n_ch_qr_no_amount/static/src/img/Feld_Betrag_40x15mm.png differ diff --git a/l10n_ch_qr_no_amount/static/src/scss/report_swissqr_no_amount.scss b/l10n_ch_qr_no_amount/static/src/scss/report_swissqr_no_amount.scss new file mode 100644 index 000000000..acd8e5c65 --- /dev/null +++ b/l10n_ch_qr_no_amount/static/src/scss/report_swissqr_no_amount.scss @@ -0,0 +1,14 @@ +.receipt_amount_edges { + position: absolute; + height: 12.5mm; /* 10 * 1.25 */ + width: 37.5mm; /* 30 * 1.25 */ + top: 89.25mm; /* 2.5 * 1.25 */ + left: 35.625mm; /* (52 - 30 + 2.5) * 1.25 = 24.5 * 1.25 */ +} +.payment_amount_edges { + position: absolute; + height: 18.75mm; /* 15 * 1.25 */ + width: 50mm; /* 40 * 1.25 */ + top: 91mm; /* 5 * 1.25 = 6.25, but it overlaps with Amount string so 8.5*/ + left: 16.625mm; /* (46 - 40 + 2.5) * 1.25 = 8.5 * 1.25 */ +} diff --git a/setup/l10n_ch_qr_no_amount/odoo/addons/l10n_ch_qr_no_amount b/setup/l10n_ch_qr_no_amount/odoo/addons/l10n_ch_qr_no_amount new file mode 120000 index 000000000..a97c2974b --- /dev/null +++ b/setup/l10n_ch_qr_no_amount/odoo/addons/l10n_ch_qr_no_amount @@ -0,0 +1 @@ +../../../../l10n_ch_qr_no_amount \ No newline at end of file diff --git a/setup/l10n_ch_qr_no_amount/setup.py b/setup/l10n_ch_qr_no_amount/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/l10n_ch_qr_no_amount/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)