Skip to content

Commit

Permalink
[MIG] l10n_ch_qr_no_amount: Migration to version 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sonhd91 committed Apr 26, 2024
1 parent db6b6b2 commit fe1fa6b
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 56 deletions.
14 changes: 13 additions & 1 deletion l10n_ch_qr_no_amount/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Switzerland - No Amount QR-bill
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:59efa6e382cfb3abcc7a32c0b79daaaf605bebc5f91b607c5b6dd8ecaeaa21ed
!! source digest: sha256:e790e1b2f6aeeeb045f9405a93cd90d9602df5da116a09a9bed3a4b571224472
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
Expand Down Expand Up @@ -45,6 +45,11 @@ payments referencing the same invoice.
.. contents::
:local:

Usage
=====

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

Bug Tracker
===========

Expand All @@ -67,6 +72,13 @@ Contributors
------------

- Akim Juillerat <[email protected]>
- Son Ho <[email protected]>

Other credits
-------------

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

Maintainers
-----------
Expand Down
1 change: 1 addition & 0 deletions l10n_ch_qr_no_amount/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from . import report
7 changes: 6 additions & 1 deletion l10n_ch_qr_no_amount/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Switzerland - No Amount QR-bill",
"summary": "Allow to print QR bill without amount",
"version": "13.0.1.0.0",
"version": "17.0.1.0.0",
"development_status": "Alpha",
"category": "Localization",
"website": "https://github.com/OCA/l10n-switzerland",
Expand All @@ -13,4 +13,9 @@
"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",
],
},
}
17 changes: 13 additions & 4 deletions l10n_ch_qr_no_amount/models/res_partner_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@
class ResPartnerBank(models.Model):
_inherit = "res.partner.bank"

def _prepare_swiss_code_url_vals(
self, amount, currency_name, debtor_partner, reference_type, reference, comment
def _l10n_ch_get_qr_vals(
self,
amount,
currency_name,
debtor_partner,
free_communication,
structured_communication,
):
res = super()._prepare_swiss_code_url_vals(
amount, currency_name, debtor_partner, reference_type, reference, comment
res = super()._l10n_ch_get_qr_vals(

Check warning on line 17 in l10n_ch_qr_no_amount/models/res_partner_bank.py

View check run for this annotation

Codecov / codecov/patch

l10n_ch_qr_no_amount/models/res_partner_bank.py#L17

Added line #L17 was not covered by tests
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)
Expand Down
1 change: 1 addition & 0 deletions l10n_ch_qr_no_amount/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Akim Juillerat \<<[email protected]>\>
- Son Ho \<<[email protected]>\>
2 changes: 2 additions & 0 deletions l10n_ch_qr_no_amount/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The migration of this module from 13.0 to 17.0 was financially supported
by Camptocamp
File renamed without changes.
1 change: 1 addition & 0 deletions l10n_ch_qr_no_amount/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import swissqr_no_amount_report
11 changes: 11 additions & 0 deletions l10n_ch_qr_no_amount/report/swissqr_no_amount_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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):
return super()._get_report_values(docids, data)

Check warning on line 11 in l10n_ch_qr_no_amount/report/swissqr_no_amount_report.py

View check run for this annotation

Codecov / codecov/patch

l10n_ch_qr_no_amount/report/swissqr_no_amount_report.py#L11

Added line #L11 was not covered by tests
52 changes: 27 additions & 25 deletions l10n_ch_qr_no_amount/report/swissqr_no_amount_report.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<report
id="l10n_ch_qr_no_amount_report"
model="account.move"
report_type="qweb-pdf"
string="QR-No-Amount-bill"
name="l10n_ch_qr_no_amount.qr_no_amount_report_main"
file="l10n_ch_qr_no_amount.qr_report_main"
attachment="'QR-bill-' + object.name + '.pdf'"
menu="False"
print_report_name="'QR-bill-%s' % object.name"
paperformat="l10n_ch.paperformat_euro_no_margin"
/>

<template id="assets_common_qr_no_amount" inherit_id="web.report_assets_common">
<xpath expr="." position="inside">
<link
type="text/scss"
rel="stylesheet"
href="/l10n_ch_qr_no_amount/static/src/scss/report_swissqr_no_amount.scss"
/>
</xpath>
</template>
<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"
Expand All @@ -39,17 +29,29 @@
<attribute name="t-value">str()</attribute>
</xpath>
<xpath
expr="//div[@id='receipt_amount_zone']//span[@t-esc='formated_amount']"
position="replace"
expr="//div[@id='receipt_amount_zone']//span[@t-out='formated_amount']"
position="attributes"
>
<attribute name="t-if">False</attribute>
</xpath>
<xpath
expr="//div[@id='receipt_amount_zone']//span[@t-out='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="replace"
expr="//div[@id='amount_zone']//span[@t-out='formated_amount']"
position="attributes"
>
<attribute name="t-if">False</attribute>
</xpath>
<xpath
expr="//div[@id='amount_zone']//span[@t-out='formated_amount']"
position="after"
>
<div><img
class="payment_amount_edges"
Expand Down
50 changes: 29 additions & 21 deletions l10n_ch_qr_no_amount/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Switzerland - No Amount QR-bill</title>
<style type="text/css">

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

Expand Down Expand Up @@ -276,7 +274,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: gray; } /* line numbers */
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -302,7 +300,7 @@
span.pre {
white-space: pre }

span.problematic, pre.problematic {
span.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,7 +366,7 @@ <h1 class="title">Switzerland - No Amount QR-bill</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:59efa6e382cfb3abcc7a32c0b79daaaf605bebc5f91b607c5b6dd8ecaeaa21ed
!! source digest: sha256:e790e1b2f6aeeeb045f9405a93cd90d9602df5da116a09a9bed3a4b571224472
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-switzerland/tree/17.0/l10n_ch_qr_no_amount"><img alt="OCA/l10n-switzerland" src="https://img.shields.io/badge/github-OCA%2Fl10n--switzerland-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-switzerland-17-0/l10n-switzerland-17-0-l10n_ch_qr_no_amount"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-switzerland&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<div class="line-block">
Expand All @@ -387,43 +385,53 @@ <h1 class="title">Switzerland - No Amount QR-bill</h1>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-5">Maintainers</a></li>
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="id6">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<p>Add the report to the print action and use it as you wish.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-switzerland/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/l10n-switzerland/issues/new?body=module:%20l10n_ch_qr_no_amount%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<ul class="simple">
<li>Camptocamp</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<ul class="simple">
<li>Akim Juillerat &lt;<a class="reference external" href="mailto:akim.juillerat&#64;camptocamp.com">akim.juillerat&#64;camptocamp.com</a>&gt;</li>
<li>Son Ho &lt;<a class="reference external" href="mailto:sonhd&#64;trobz.com">sonhd&#64;trobz.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#id6">Other credits</a></h2>
<p>The migration of this module from 13.0 to 17.0 was financially supported
by Camptocamp</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
position: absolute;
height: 12.5mm; /* 10 * 1.25 */
width: 37.5mm; /* 30 * 1.25 */
top: 3.125mm; /* 2.5 * 1.25 */
left: 30.625mm; /* (52 - 30 + 2.5) * 1.25 = 24.5 * 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: 8.5mm; /* 5 * 1.25 = 6.25, but it overlaps with Amount string so 8.5*/
left: 10.625mm; /* (46 - 40 + 2.5) * 1.25 = 8.5 * 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 */
}

0 comments on commit fe1fa6b

Please sign in to comment.