-
-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][MIG] l10n_ch_qr_no_amount #742
Open
santostelmo
wants to merge
7
commits into
OCA:16.0
Choose a base branch
from
camptocamp:16.0-mig-l10n_ch_qr_no_amount
base: 16.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e362ca2
Add module l10n_ch_qr_no_amount
grindtildeath 0db9c40
l10n_ch_qr_no_amount: Fix edges position on QR slip
grindtildeath fa89586
[ADD] icon.png
OCA-git-bot d223b76
[IMP] l10n_ch_qr_no_amount: pre-commit auto fixes
8018658
[MIG] l10n_ch_qr_no_amount: Migration to version 17.0
0659edc
[UPD] Update l10n_ch_qr_no_amount.pot
e19fd85
[MIG] l10n_ch_qr_no_amount: Migration to version 16.0
santostelmo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,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 <https://odoo-community.org/page/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 <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 to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/l10n-switzerland/issues/new?body=module:%20l10n_ch_qr_no_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 | ||
------------ | ||
|
||
- Akim Juillerat <[email protected]> | ||
- Son Ho <[email protected]> | ||
- 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. | ||
|
||
.. |maintainer-grindtildeath| image:: https://github.com/grindtildeath.png?size=40px | ||
:target: https://github.com/grindtildeath | ||
:alt: grindtildeath | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-grindtildeath| | ||
|
||
This module is part of the `OCA/l10n-switzerland <https://github.com/OCA/l10n-switzerland/tree/16.0/l10n_ch_qr_no_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,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", | ||
], | ||
}, | ||
} |
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,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 "" |
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 res_partner_bank |
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,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 | ||
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 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
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 @@ | ||
- Akim Juillerat \<<[email protected]>\> | ||
- Son Ho \<<[email protected]>\> | ||
- 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,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. |
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 @@ | ||
Add the report to the print action and use it as you wish. |
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_no_amount_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,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) | ||
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,74 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<record id="l10n_ch_qr_no_amount_report" model="ir.actions.report"> | ||
<field name="name">QR-No-Amount-bill</field> | ||
<field name="model">account.move</field> | ||
<field name="report_type">qweb-pdf</field> | ||
<field name="report_name">l10n_ch_qr_no_amount.qr_no_amount_report_main</field> | ||
<field name="report_file">l10n_ch_qr_no_amount.qr_report_main</field> | ||
<field name="attachment">'QR-bill-' + object.name + '.pdf'</field> | ||
<field name="print_report_name">'QR-bill-%s' % object.name</field> | ||
<field name="binding_model_id" ref="account.model_account_move" /> | ||
<field name="paperformat_id" ref="l10n_ch.paperformat_euro_no_margin" /> | ||
</record> | ||
|
||
<template | ||
id="l10n_ch_swissqr_no_amount_template" | ||
inherit_id="l10n_ch.l10n_ch_swissqr_template" | ||
primary="True" | ||
> | ||
|
||
<xpath expr="//t[@t-set='o']" position="attributes"> | ||
<attribute | ||
name="t-value" | ||
>o.with_context(**{'lang': lang, '_no_amount_qr_code': True})</attribute> | ||
</xpath> | ||
<!-- Replace amount with blank fields with black corners --> | ||
<xpath expr="//t[@t-set='formated_amount']" position="attributes"> | ||
<attribute name="t-value">str()</attribute> | ||
</xpath> | ||
<xpath | ||
expr="//div[@id='receipt_amount_zone']//span[@t-esc='formated_amount']" | ||
position="attributes" | ||
> | ||
<attribute name="t-if">False</attribute> | ||
</xpath> | ||
<xpath | ||
expr="//div[@id='receipt_amount_zone']//span[@t-esc='formated_amount']" | ||
position="after" | ||
> | ||
<img | ||
class="receipt_amount_edges" | ||
src="/l10n_ch_qr_no_amount/static/src/img/Betragsfeld_Eckmarke.png" | ||
/> | ||
</xpath> | ||
<xpath | ||
expr="//div[@id='amount_zone']//span[@t-esc='formated_amount']" | ||
position="attributes" | ||
> | ||
<attribute name="t-if">False</attribute> | ||
</xpath> | ||
<xpath | ||
expr="//div[@id='amount_zone']//span[@t-esc='formated_amount']" | ||
position="after" | ||
> | ||
<div><img | ||
class="payment_amount_edges" | ||
src="/l10n_ch_qr_no_amount/static/src/img/Feld_Betrag_40x15mm.png" | ||
/></div> | ||
</xpath> | ||
</template> | ||
|
||
<template id="l10n_ch_qr_no_amount.qr_no_amount_report_main"> | ||
<t t-call="web.html_container"> | ||
<t t-foreach="docs" t-as="o"> | ||
<t t-set="lang" t-value="o.partner_id.lang" /> | ||
<t | ||
t-call="l10n_ch_qr_no_amount.l10n_ch_swissqr_no_amount_template" | ||
t-lang="lang" | ||
/> | ||
</t> | ||
</t> | ||
</template> | ||
</odoo> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition will always evaluate to True as it's the
_name
of theclass
where the override is done.You can cherry-pick from #745 to solve the amount encoded in QR issue that was introduced in the migration to 17.0