mirror of
https://gitlab.com/flectra-community/l10n-switzerland-flectra.git
synced 2024-12-23 04:41:45 +00:00
[FIX] Issue #3 l10n_ch_qr_bill open module info causes error
[FIX] Issue #2 Installing l10n_ch_zip causes Warning
This commit is contained in:
parent
8c01fd05d8
commit
9b0288fb15
@ -18,13 +18,35 @@ It supports both QRR references and no structured references.
|
||||
|
||||
Creditor References implemented now!
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `Gitlab Issues <https://gitlab.com/flectra-community/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 `here <https://gitlab.com/flectra-community/l10n-switzerland/-/issues/new>`_.
|
||||
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
------------
|
||||
|
||||
* Jamotion <info@jamotion.ch>
|
||||
* Odoo SA
|
||||
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
|
||||
* Flectra Community
|
||||
* Flectra Community
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: https://flectra-community.org/logo.png
|
||||
:alt: Flectra Community
|
||||
:target: https://flectra-community.org/
|
||||
|
||||
This module is maintained by the OCA and Flectra Community.
|
||||
|
||||
OCA, or the Odoo Community Association, or Flectra Community, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.
|
||||
|
||||
To contribute to this module, please visit https://flectra-community.org/.
|
||||
|
@ -5,10 +5,10 @@
|
||||
{
|
||||
'name': 'Switzerland - QR-bill',
|
||||
'summary': 'Print QR-bill for your invoices',
|
||||
'version': '2.0.1.1.1',
|
||||
'author': "Camptocamp, Odoo Community Association (OCA), Flectra Community, 2BIT GmbH",
|
||||
'version': '11.0.1.1.1',
|
||||
'author': "Camptocamp, Odoo Community Association (OCA), Flectra Community",
|
||||
'category': 'Localization',
|
||||
'website': 'https://gitlab.com/flectra-community/flectra',
|
||||
'website': 'https://gitlab.com/flectra-community/l10n-switzerland',
|
||||
'license': 'LGPL-3',
|
||||
'depends': ['base', 'account', 'base_iban', 'web', 'l10n_ch_base_bank'],
|
||||
'data': [
|
||||
|
@ -181,7 +181,7 @@ class AccountInvoice(models.Model):
|
||||
)
|
||||
debtor_addr_1, debtor_addr_2 = self._get_partner_address_lines(debtor)
|
||||
|
||||
amount = '{:.2f}'.format(self.amount_residual)
|
||||
amount = '{:.2f}'.format(self.residual)
|
||||
acc_number = self.partner_bank_id.sanitized_acc_number
|
||||
|
||||
# If there is a QR IBAN we use it for the barcode instead of the
|
||||
|
@ -26,4 +26,4 @@ class SwissQrBill(models.Model):
|
||||
)
|
||||
return qrcode.asString('png')
|
||||
except (ValueError, AttributeError):
|
||||
raise ValueError("Cannot convert into QR code.")
|
||||
raise ValueError("Cannot convert into QR code.")
|
@ -1,18 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra>
|
||||
<data>
|
||||
|
||||
<report
|
||||
id="l10n_ch_qr_report"
|
||||
model="account.move"
|
||||
model="account.invoice"
|
||||
report_type="qweb-pdf"
|
||||
string="QR-bill"
|
||||
name="l10n_ch_qr_bill.qr_report_main"
|
||||
file="l10n_ch_qr_bill.qr_report_main"
|
||||
attachment="'QR-bill-' + object.name + '.pdf'"
|
||||
attachment="'QR-bill-' + object.number + '.pdf'"
|
||||
menu="False"/>
|
||||
|
||||
<record id="l10n_ch_qr_report" model="ir.actions.report">
|
||||
<field name="print_report_name">'QR-bill-%s.pdf' % object.name</field>
|
||||
<field name="print_report_name">'QR-bill-%s.pdf' % object.number</field>
|
||||
<field name="paperformat_id" ref="l10n_ch_qr_bill.paperformat_euro_no_margin"/>
|
||||
</record>
|
||||
|
||||
@ -24,10 +25,10 @@
|
||||
<div class="page l10n_ch_qr">
|
||||
<link type="text/css" rel="stylesheet" href="/l10n_ch_qr_bill/static/src/css/report_swissqr.css"/>
|
||||
|
||||
<t t-set="formated_amount" t-value="'{:,.2f}'.format(o.amount_residual).replace(',',' ')"/>
|
||||
<t t-set="formated_amount" t-value="'{:,.2f}'.format(o.residual).replace(',',' ')"/>
|
||||
|
||||
<div class="swissqr_title">
|
||||
<h1>QR-bill for invoice <t t-esc="o.name"/></h1>
|
||||
<h1>QR-bill for invoice <t t-esc="o.number"/></h1>
|
||||
</div>
|
||||
|
||||
<div class="swissqr_content">
|
||||
@ -114,14 +115,14 @@
|
||||
</div>
|
||||
<div class="swissqr_text">
|
||||
<span class="title">Additional information</span><br/>
|
||||
<span class="content" t-field="o.name"/><br/>
|
||||
<span class="content" t-field="o.number"/><br/>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-if="not o.partner_bank_id._is_qr_iban()">
|
||||
<div class="swissqr_text">
|
||||
<span class="title">Additional information</span><br/>
|
||||
<span class="content" t-raw="o.name"/><br/>
|
||||
<span class="content" t-raw="o.name or o.number"/><br/>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
'name': 'Switzerland - Postal codes (ZIP) list',
|
||||
'version': '1.0.1.0.0',
|
||||
'version': '2.0.1.0.0',
|
||||
'author': '''
|
||||
Camptocamp,
|
||||
brain-tec AG,
|
||||
|
5320
l10n_ch_zip/data/res.better.zip.csv
Normal file
5320
l10n_ch_zip/data/res.better.zip.csv
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@ from flectra.tools import convert_file
|
||||
def import_csv_data(cr, registry):
|
||||
"""Import CSV data as it is faster than xml and because we can't use
|
||||
noupdate anymore with csv"""
|
||||
filenames = ['data/res.city.csv', 'data/res.city.zip.csv']
|
||||
filenames = ['data/res.better.zip.csv']
|
||||
for filename in filenames:
|
||||
convert_file(
|
||||
cr, 'l10n_ch_zip',
|
||||
|
@ -1 +1 @@
|
||||
from . import city_zip
|
||||
from . import better_zip
|
||||
|
65
l10n_ch_zip/models/better_zip.py
Normal file
65
l10n_ch_zip/models/better_zip.py
Normal file
@ -0,0 +1,65 @@
|
||||
# Copyright 2011-2017 Camptocamp SA
|
||||
# Copyright 2014 Olivier Jossen (brain-tec AG)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from flectra import models, fields, api
|
||||
from flectra.exceptions import ValidationError
|
||||
|
||||
|
||||
class ResBetterZip(models.Model):
|
||||
""" Inherit res.better.zip class in order to add swiss specific fields
|
||||
|
||||
Fields from the original file downloaded from here:
|
||||
https://match.post.ch/downloadCenter?product=2 -> File "PLZ Plus 1"
|
||||
|
||||
Documentation:
|
||||
http://www.swisspost.ch/post-startseite/post-adress-services-match/post-direct-marketing-datengrundlage/post-match-zip-factsheet.pdf
|
||||
"""
|
||||
|
||||
_inherit = 'res.better.zip'
|
||||
|
||||
active = fields.Boolean(string='Active', default=True)
|
||||
onrp = fields.Char(string='Swiss Post classification no. (ONRP)',
|
||||
size=5, help="Primary Key")
|
||||
zip_type = fields.Char(string='Postcode type', size=2)
|
||||
additional_digit = fields.Char(string='Additional poscode digits', size=2)
|
||||
lang = fields.Char(
|
||||
string='Language code', size=1,
|
||||
help="Language (language majority) within a postcode area. "
|
||||
"1 = German, 2 = French, 3 = Italian, 4 = Romansh. "
|
||||
"For multi-lingual localities, the main language is indicated.",
|
||||
)
|
||||
lang2 = fields.Char(
|
||||
'Alternative language code',
|
||||
size=1,
|
||||
help="Additional language within a postcode.\n"
|
||||
"One alternative language code may appear for each postcode.\n"
|
||||
"1 = German, 2 = French, 3 = Italian, 4 = Romansh.",
|
||||
)
|
||||
sort = fields.Boolean(
|
||||
string='Present in sort file',
|
||||
help="Indicates if the postcode is included in the «sort file»"
|
||||
"(MAT[CH]sort): 0 = not included, 1 = included. "
|
||||
"Delivery information with addresses (only postcode and "
|
||||
"streets) are published in the sort file.",
|
||||
)
|
||||
post_delivery_through = fields.Integer(
|
||||
string='Mail delivery by',
|
||||
help="Indicates the post office (ONRP) that delivers most of the "
|
||||
"letters to the postcode addresses. This information can be "
|
||||
"used for bag addresses too."
|
||||
)
|
||||
communitynumber_bfs = fields.Integer(
|
||||
string='FSO municipality number (BFSNR)',
|
||||
help="Numbering used by the Federal Statistical Office for "
|
||||
"municipalities in Switzerland and the Principality of "
|
||||
"Liechtenstein",
|
||||
)
|
||||
valid_from = fields.Date(string='Valid from')
|
||||
|
||||
@api.constrains('post_delivery_through','communitynumber_bfs')
|
||||
def _check_length(self):
|
||||
for record in self:
|
||||
if record.post_delivery_through > 99999:
|
||||
raise ValidationError("post_delivery_through cannot be greater than 99999")
|
||||
if record.communitynumber_bfs > 99999:
|
||||
raise ValidationError("communitynumber_bfs cannot be greater than 99999")
|
Loading…
Reference in New Issue
Block a user