-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] l10n_ch_qr_bill_without_amount
- Loading branch information
1 parent
b7e35fd
commit a883784
Showing
20 changed files
with
816 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
========================================= | ||
L10n Switzerland - QR Bill without Amount | ||
========================================= | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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-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_bill_without_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_bill_without_amount | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/l10n-switzerland&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Allows you to print QR invoices without a predefined amount. The QR invoice without an amount is based on the payment mode field `Qr Bill Without Amount` | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-switzerland/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 <https://github.com/OCA/l10n-switzerland/issues/new?body=module:%20l10n_ch_qr_bill_without_amount%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Camptocamp | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Telmo Santos <[email protected]> | ||
|
||
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/l10n-switzerland <https://github.com/OCA/l10n-switzerland/tree/16.0/l10n_ch_qr_bill_without_amount>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import models | ||
from . import report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2024 Camptocamp (<https://www.camptocamp.com>). | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "L10n Switzerland - QR Bill without Amount", | ||
"version": "16.0.1.0.0", | ||
"category": "Localization", | ||
"summary": "Print QR Bill without amount", | ||
"author": "Camptocamp, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/l10n-switzerland", | ||
"license": "AGPL-3", | ||
"depends": [ | ||
"l10n_ch", | ||
"account_payment_partner", | ||
], | ||
"data": [ | ||
"views/payment_mode.xml", | ||
"report/swissqr_report.xml", | ||
], | ||
"installable": True, | ||
"auto_install": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * l10n_ch_qr_bill_without_amount | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0+e\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-11-12 10:40+0000\n" | ||
"PO-Revision-Date: 2024-11-12 10:40+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: l10n_ch_qr_bill_without_amount | ||
#: model:ir.model,name:l10n_ch_qr_bill_without_amount.model_res_partner_bank | ||
msgid "Bank Accounts" | ||
msgstr "" | ||
|
||
#. module: l10n_ch_qr_bill_without_amount | ||
#: model:ir.model,name:l10n_ch_qr_bill_without_amount.model_account_move | ||
msgid "Journal Entry" | ||
msgstr "" | ||
|
||
#. module: l10n_ch_qr_bill_without_amount | ||
#: model:ir.model,name:l10n_ch_qr_bill_without_amount.model_account_payment_mode | ||
msgid "Payment Modes" | ||
msgstr "" | ||
|
||
#. module: l10n_ch_qr_bill_without_amount | ||
#: model:ir.model.fields,field_description:l10n_ch_qr_bill_without_amount.field_account_bank_statement_line__qr_bill_amount | ||
#: model:ir.model.fields,field_description:l10n_ch_qr_bill_without_amount.field_account_move__qr_bill_amount | ||
#: model:ir.model.fields,field_description:l10n_ch_qr_bill_without_amount.field_account_payment__qr_bill_amount | ||
msgid "Qr Bill Amount" | ||
msgstr "" | ||
|
||
#. module: l10n_ch_qr_bill_without_amount | ||
#: model:ir.model.fields,field_description:l10n_ch_qr_bill_without_amount.field_account_payment_mode__qr_bill_without_amount | ||
msgid "Qr Bill Without Amount" | ||
msgstr "" | ||
|
||
#. module: l10n_ch_qr_bill_without_amount | ||
#: model:ir.model,name:l10n_ch_qr_bill_without_amount.model_report_l10n_ch_qr_report_main | ||
msgid "Swiss QR-bill report" | ||
msgstr "" |
28 changes: 28 additions & 0 deletions
28
l10n_ch_qr_bill_without_amount/i18n/l10n_ch_qr_bill_without_amount copy.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * l10n_ch_qr_bill_without_amount | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0+e\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-11-12 10:40+0000\n" | ||
"PO-Revision-Date: 2024-11-12 10:40+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: l10n_ch_qr_bill_without_amount | ||
#: model:ir.model.fields,field_description:l10n_ch_qr_bill_without_amount.field_account_bank_statement_line__qr_bill_amount | ||
#: model:ir.model.fields,field_description:l10n_ch_qr_bill_without_amount.field_account_move__qr_bill_amount | ||
#: model:ir.model.fields,field_description:l10n_ch_qr_bill_without_amount.field_account_payment__qr_bill_amount | ||
msgid "Qr Bill Amount" | ||
msgstr "Montant de la facture Qr" | ||
|
||
#. module: l10n_ch_qr_bill_without_amount | ||
#: model:ir.model.fields,field_description:l10n_ch_qr_bill_without_amount.field_account_payment_mode__qr_bill_without_amount | ||
msgid "Qr Bill Without Amount" | ||
msgstr "Facture Qr sans montant" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import res_partner_bank | ||
from . import payment_mode | ||
from . import account_move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2024 Camptocamp (<https://www.camptocamp.com>). | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class AccountMove(models.Model): | ||
_inherit = "account.move" | ||
|
||
qr_bill_amount = fields.Char( | ||
compute="_compute_qr_bill_amount", | ||
) | ||
|
||
@api.depends("amount_residual") | ||
def _compute_qr_bill_amount(self): | ||
for move in self: | ||
if move.payment_mode_id.qr_bill_without_amount: | ||
move.qr_bill_amount = "" | ||
else: | ||
move.qr_bill_amount = "{:,.2f}".format(move.amount_residual).replace( | ||
",", "\xa0" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright 2024 Camptocamp (<https://www.camptocamp.com>). | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class AccountPaymentMode(models.Model): | ||
_inherit = "account.payment.mode" | ||
|
||
qr_bill_without_amount = fields.Boolean() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2024 Camptocamp (<https://www.camptocamp.com>). | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models | ||
|
||
|
||
class ResPartnerBank(models.Model): | ||
_inherit = "res.partner.bank" | ||
|
||
def _l10n_ch_get_qr_vals( | ||
self, | ||
amount, | ||
currency, | ||
debtor_partner, | ||
free_communication, | ||
structured_communication, | ||
): | ||
res = super()._l10n_ch_get_qr_vals( | ||
amount, | ||
currency, | ||
debtor_partner, | ||
free_communication, | ||
structured_communication, | ||
) | ||
if self.env.context.get("qr_bill_without_amount", {}).get(free_communication): | ||
# Amount position | ||
res[18] = "" | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Telmo Santos <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Allows you to print QR invoices without a predefined amount. The QR invoice without an amount is based on the payment mode field `Qr Bill Without Amount` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import swissqr_report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from odoo import api, models | ||
|
||
|
||
class ReportSwissQR(models.AbstractModel): | ||
_inherit = "report.l10n_ch.qr_report_main" | ||
|
||
@api.model | ||
def _get_report_values(self, docids, data=None): | ||
docs = self.env["account.move"].browse(docids) | ||
qr_bill_without_amount = {} | ||
for invoice in docs: | ||
if invoice.payment_mode_id.qr_bill_without_amount: | ||
# We sent invoice ref or name in context to be able to retrieve | ||
# it in res.partner.bank._l10n_ch_get_qr_vals | ||
qr_bill_without_amount[ | ||
invoice.ref or invoice.name | ||
] = invoice.payment_mode_id.qr_bill_without_amount | ||
self = self.with_context(qr_bill_without_amount=qr_bill_without_amount) | ||
return super(ReportSwissQR, self)._get_report_values(docids, data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<template | ||
id="l10n_ch_swissqr_template" | ||
inherit_id="l10n_ch.l10n_ch_swissqr_template" | ||
> | ||
<xpath expr="//t[@t-set='formated_amount']" position="attributes"> | ||
<attribute name="t-value">o.qr_bill_amount</attribute> | ||
</xpath> | ||
</template> | ||
</odoo> |
Oops, something went wrong.