mirror of
https://github.com/bringout/oca-ocb-l10n_europe.git
synced 2026-04-27 10:22:07 +02:00
19.0 vanilla
This commit is contained in:
parent
ff721d030e
commit
7721452493
1826 changed files with 124775 additions and 274114 deletions
|
|
@ -1,157 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="paperformat_euro_no_margin" model="report.paperformat">
|
||||
<field name="name">European A4 without borders</field>
|
||||
<field name="default" eval="False" />
|
||||
<field name="format">A4</field>
|
||||
<field name="orientation">Portrait</field>
|
||||
<field name="margin_top">0</field>
|
||||
<field name="margin_bottom">0</field>
|
||||
<field name="margin_left">0</field>
|
||||
<field name="margin_right">0</field>
|
||||
<field name="header_line" eval="False" />
|
||||
<field name="header_spacing">0</field>
|
||||
</record>
|
||||
|
||||
<!--Report containing an ISR corrresponding to an invoice.-->
|
||||
<record id="l10n_ch_isr_report" model="ir.actions.report">
|
||||
<field name="name">ISR</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="report_name">l10n_ch.isr_report_main</field>
|
||||
<field name="report_file">l10n_ch.isr_report_main</field>
|
||||
<field name="print_report_name">'ISR-%s' % object.name</field>
|
||||
<field name="paperformat_id" ref="paperformat_euro_no_margin"/>
|
||||
<field name="attachment">'ISR-' + object.name + '.pdf'</field>
|
||||
<field name="attachment_use">True</field>
|
||||
</record>
|
||||
<!--No additional condition in report name on invoice state or type as this
|
||||
report is only available to be printed for out invoices after
|
||||
'draft' state, if the fields required by the ISR have been set.-->
|
||||
|
||||
<template id="l10n_ch_isr_report_template">
|
||||
<t t-call="web.external_layout">
|
||||
<t t-set="split_total_amount" t-value="invoice.split_total_amount()"/>
|
||||
<t t-set="print_bank" t-value="invoice.company_id.l10n_ch_isr_print_bank_location"/>
|
||||
|
||||
<!-- add class to body tag -->
|
||||
<script>document.body.className += " l10n_ch_isr";</script>
|
||||
|
||||
<!-- since the body content take the whole page we need a way to add margin
|
||||
back on content outside the ISR so it does not overlap with the header -->
|
||||
<div id="content_outside_isr">
|
||||
<h1>ISR for invoice <t t-esc="invoice.name"/></h1>
|
||||
</div>
|
||||
|
||||
<div id="isr" t-att-class="'isr-print-bank' if print_bank else None">
|
||||
|
||||
<!--Voucher, left part of the ISR.-->
|
||||
<div id="voucher">
|
||||
<!--Einzahlung für/Versement pour/Versamento per-->
|
||||
|
||||
<!--If we use the alternate ISR layout, displaying name
|
||||
and location of the bank.-->
|
||||
<t t-if="print_bank">
|
||||
<div id="voucher-for-bank">
|
||||
<p t-if="not invoice.company_id.l10n_ch_isr_preprinted_bank">
|
||||
<t t-esc="invoice.partner_bank_id.bank_id.name"/><br />
|
||||
<t t-esc="invoice.partner_bank_id.bank_id.zip"/>
|
||||
<t t-esc="invoice.partner_bank_id.bank_id.city"/>
|
||||
</p>
|
||||
</div>
|
||||
<!--Zugunsten von/En faveur de/A favore di-->
|
||||
</t>
|
||||
<div id="voucher-for-contact">
|
||||
<p id="voucher-for_name" t-field="invoice.company_id.display_name"/>
|
||||
<p id="voucher-for_address1" t-field="invoice.company_id.street"/>
|
||||
<p id="voucher-for_address2" t-field="invoice.company_id.street2"/>
|
||||
<p id="voucher-for_address3">
|
||||
<t t-esc="invoice.company_id.zip"/>
|
||||
<t t-esc="invoice.company_id.city"/>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="voucher-bank" t-if="not print_bank or not invoice.company_id.l10n_ch_isr_preprinted_account">
|
||||
<!--Konto/Compte/Conto-->
|
||||
<p id="voucher-bank_ref" t-field="invoice.l10n_ch_isr_subscription_formatted"/>
|
||||
</div>
|
||||
|
||||
<p id="voucher-amount_units" t-esc="split_total_amount[0]"/>
|
||||
<p id="voucher-amount_cents" t-esc="split_total_amount[1]"/>
|
||||
|
||||
<div id="voucher-by">
|
||||
<!--Einbezahlt von/Versé par/Versato da-->
|
||||
<p id="voucher-by_reference_number" t-field="invoice.l10n_ch_isr_number"/>
|
||||
<address id="voucher-by_customer_address" t-field="invoice.partner_id" t-options='{"widget": "contact", "fields": ["address","name"], "no_marker": True}' />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Slip, right part of the ISR.-->
|
||||
<div id="slip">
|
||||
<!--Einzahlung für/Versement pour/Versamento per-->
|
||||
|
||||
<!--If we use the alternate ISR layout, displaying name
|
||||
and location of the bank.-->
|
||||
<t t-if="print_bank">
|
||||
<div id="slip-for-bank">
|
||||
<p t-if="not invoice.company_id.l10n_ch_isr_preprinted_bank">
|
||||
<t t-esc="invoice.partner_bank_id.bank_id.name"/><br />
|
||||
<t t-esc="invoice.partner_bank_id.bank_id.zip"/>
|
||||
<t t-esc="invoice.partner_bank_id.bank_id.city"/>
|
||||
</p>
|
||||
</div>
|
||||
<!--Zugunsten von/En faveur de/A favore di-->
|
||||
</t>
|
||||
|
||||
<div id="slip-for-contact">
|
||||
<p id="slip-for_name" t-field="invoice.company_id.display_name"/>
|
||||
<p id="slip-for_address1" t-field="invoice.company_id.street"/>
|
||||
<p id="slip-for_address2" t-field="invoice.company_id.street2"/>
|
||||
<p id="slip-for_address3">
|
||||
<t t-esc="invoice.company_id.zip"/>
|
||||
<t t-esc="invoice.company_id.city"/>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="slip-bank" t-if="not print_bank or not invoice.company_id.l10n_ch_isr_preprinted_account">
|
||||
<!--Konto/Compte/Conto-->
|
||||
<!--aka ISR Subscriber number provided by the financial institution-->
|
||||
<p id="slip-bank_ref" t-field="invoice.l10n_ch_isr_subscription_formatted"/>
|
||||
</div>
|
||||
|
||||
<p id="slip-amount_units" t-esc="split_total_amount[0]"/>
|
||||
<p id="slip-amount_cents" t-esc="split_total_amount[1]"/>
|
||||
|
||||
<div id="slip-reference">
|
||||
<!--Referenz-Nr./N°de référence/N°di riferimento-->
|
||||
<p id="slip-reference_number" t-field="invoice.l10n_ch_isr_number_spaced"/>
|
||||
</div>
|
||||
|
||||
<div id="slip-by">
|
||||
<!--Einbezahlt von/Versé par/Versato da-->
|
||||
<address id="slip-by_customer_address" t-field="invoice.partner_id" t-options='{"widget": "contact", "fields": ["address","name"], "no_marker": True}' />
|
||||
</div>
|
||||
|
||||
<div id="slip-optical-line">
|
||||
<!--Optical reference-->
|
||||
<div t-attf-style="top: {{ invoice.company_id.l10n_ch_isr_scan_line_top }}mm; left: {{ invoice.company_id.l10n_ch_isr_scan_line_left }}mm;">
|
||||
<div t-foreach="invoice.l10n_ch_isr_optical_line" t-as="char" t-esc="char" t-attf-style="right: {{ round((char_size - char_index - 1) * 0.1, 1) }}in"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="l10n_ch.isr_report_main">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="invoice">
|
||||
<t t-set="o" t-value="invoice"/>
|
||||
<t t-call="l10n_ch.l10n_ch_isr_report_template"/>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
# -*- coding:utf-8 -*-
|
||||
from odoo import api, models
|
||||
|
||||
class ReportSwissQR(models.AbstractModel):
|
||||
|
||||
class ReportL10n_ChQr_Report_Main(models.AbstractModel):
|
||||
_name = 'report.l10n_ch.qr_report_main'
|
||||
_description = 'Swiss QR-bill report'
|
||||
|
||||
|
|
@ -11,7 +12,7 @@ class ReportSwissQR(models.AbstractModel):
|
|||
|
||||
qr_code_urls = {}
|
||||
for invoice in docs:
|
||||
qr_code_urls[invoice.id] = invoice.partner_bank_id.build_qr_code_base64(invoice.amount_residual, invoice.ref or invoice.name, invoice.payment_reference, invoice.currency_id, invoice.partner_id, qr_method='ch_qr', silent_errors=False)
|
||||
qr_code_urls[invoice.id] = invoice.partner_bank_id.build_qr_code_base64(invoice.amount_residual, invoice.payment_reference or invoice.name, invoice.payment_reference, invoice.currency_id, invoice.partner_id, qr_method='ch_qr', silent_errors=False)
|
||||
|
||||
return {
|
||||
'doc_ids': docids,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="paperformat_euro_no_margin" model="report.paperformat">
|
||||
<field name="name">European A4 without borders</field>
|
||||
<field name="default" eval="False" />
|
||||
<field name="format">A4</field>
|
||||
<field name="orientation">Portrait</field>
|
||||
<field name="margin_top">0</field>
|
||||
<field name="margin_bottom">0</field>
|
||||
<field name="margin_left">0</field>
|
||||
<field name="margin_right">0</field>
|
||||
<field name="header_line" eval="False" />
|
||||
<field name="header_spacing">0</field>
|
||||
</record>
|
||||
|
||||
<record id="l10n_ch_qr_report" model="ir.actions.report">
|
||||
<field name="name">QR-bill</field>
|
||||
|
|
@ -12,31 +24,14 @@
|
|||
<field name="paperformat_id" ref="l10n_ch.paperformat_euro_no_margin"/>
|
||||
</record>
|
||||
|
||||
<record id="l10n_ch_qr_header" model="ir.actions.report">
|
||||
<field name="name">QR-bill Header</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="report_name">l10n_ch.qr_report_header</field>
|
||||
<field name="report_file">l10n_ch.qr_report_header</field>
|
||||
</record>
|
||||
|
||||
<template id="l10n_ch_header_template">
|
||||
<t t-call="web.external_layout">
|
||||
<!--The following elements are necessary for the header to be displayed correctly.-->
|
||||
<br/>
|
||||
<p>&nbsp;</p>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="l10n_ch_swissqr_template">
|
||||
<div class="article" t-att-data-oe-model="o._name" t-att-data-oe-id="o.id">
|
||||
<t t-set="o" t-value="o.with_context(lang=lang)"/>
|
||||
<t t-set="company" t-value="o.company_id"/>
|
||||
<t t-set="company" t-value="o.partner_bank_id.partner_id or o.company_id"/>
|
||||
<t t-set="formated_amount" t-value="'{:,.2f}'.format(o.amount_residual).replace(',','\xa0')"/>
|
||||
|
||||
<t t-set="is_qrr" t-value="o.partner_bank_id.l10n_ch_qr_iban"/>
|
||||
<t t-set="is_scor" t-value="o.partner_bank_id._is_iso11649_reference(o.payment_reference)"/>
|
||||
|
||||
<div class="swissqr_content_v2">
|
||||
|
||||
<div class="swissqr_receipt">
|
||||
|
|
@ -56,11 +51,11 @@
|
|||
<span t-field="o.partner_bank_id.acc_number" t-if="not o.partner_bank_id.l10n_ch_qr_iban"/>
|
||||
<span t-field="o.partner_bank_id.l10n_ch_qr_iban" t-if="o.partner_bank_id.l10n_ch_qr_iban"/>
|
||||
<br/>
|
||||
<span t-esc="o.partner_bank_id.acc_holder_name or o.company_id.name"/><br/>
|
||||
<span t-field="o.company_id.street"/><br/>
|
||||
<span t-field="o.company_id.country_id.code"/>
|
||||
<span t-field="o.company_id.zip"/>
|
||||
<span t-field="o.company_id.city"/><br/>
|
||||
<span t-out="company.name"/><br/>
|
||||
<span t-field="company.street"/><br/>
|
||||
<span t-field="company.country_id.code"/>
|
||||
<span t-field="company.zip"/>
|
||||
<span t-field="company.city"/><br/>
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
|
|
@ -71,13 +66,13 @@
|
|||
</t>
|
||||
<t t-if="is_qrr">
|
||||
<div class="swissqr_text content">
|
||||
<span t-esc="o.space_qrr_reference(o.payment_reference)"/><br/>
|
||||
<span t-out="o.space_qrr_reference(o.payment_reference)"/><br/>
|
||||
<br/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="is_scor">
|
||||
<div class="swissqr_text content">
|
||||
<span t-esc="o.space_scor_reference(o.payment_reference)"/><br/>
|
||||
<span t-out="o.space_scor_reference(o.payment_reference)"/><br/>
|
||||
<br/>
|
||||
</div>
|
||||
</t>
|
||||
|
|
@ -111,7 +106,7 @@
|
|||
<span>Amount</span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<span t-esc="formated_amount"/>
|
||||
<span t-out="formated_amount"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -152,7 +147,7 @@
|
|||
<span>Amount</span><br/>
|
||||
</div>
|
||||
<div class="content">
|
||||
<span t-esc="formated_amount"/>
|
||||
<span t-out="formated_amount"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -168,11 +163,11 @@
|
|||
<span t-field="o.partner_bank_id.acc_number" t-if="not o.partner_bank_id.l10n_ch_qr_iban"/>
|
||||
<span t-field="o.partner_bank_id.l10n_ch_qr_iban" t-if="o.partner_bank_id.l10n_ch_qr_iban"/>
|
||||
<br/>
|
||||
<span t-esc="o.partner_bank_id.acc_holder_name or o.company_id.name"/><br/>
|
||||
<span t-field="o.company_id.street"/><br/>
|
||||
<span t-field="o.company_id.country_id.code"/>
|
||||
<span t-field="o.company_id.zip"/>
|
||||
<span t-field="o.company_id.city"/><br/>
|
||||
<span t-out="company.name"/><br/>
|
||||
<span t-field="company.street"/><br/>
|
||||
<span t-field="company.country_id.code"/>
|
||||
<span t-field="company.zip"/>
|
||||
<span t-field="company.city"/><br/>
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
|
|
@ -183,13 +178,13 @@
|
|||
</t>
|
||||
<t t-if="is_qrr">
|
||||
<div class="swissqr_text content">
|
||||
<span t-esc="o.space_qrr_reference(o.payment_reference)"/><br/>
|
||||
<span t-out="o.space_qrr_reference(o.payment_reference)"/><br/>
|
||||
<br/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="is_scor">
|
||||
<div class="swissqr_text content">
|
||||
<span t-esc="o.space_scor_reference(o.payment_reference)"/><br/>
|
||||
<span t-out="o.space_scor_reference(o.payment_reference)"/><br/>
|
||||
<br/>
|
||||
</div>
|
||||
</t>
|
||||
|
|
@ -200,7 +195,7 @@
|
|||
<span>Additional information</span>
|
||||
</div>
|
||||
<div class="swissqr_text content">
|
||||
<span t-esc="additional_info"/><br/>
|
||||
<span t-out="additional_info"/><br/>
|
||||
<br/>
|
||||
</div>
|
||||
</t>
|
||||
|
|
@ -232,20 +227,10 @@
|
|||
</t>
|
||||
</template>
|
||||
|
||||
<template id="l10n_ch.qr_report_header">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="invoice">
|
||||
<t t-set="o" t-value="invoice"/>
|
||||
<t t-set="lang" t-value="o.partner_id.lang"/>
|
||||
<t t-call="l10n_ch.l10n_ch_header_template" t-lang="lang"/>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="minimal_layout_with_report_attribute" inherit_id="web.minimal_layout">
|
||||
<body position="attributes">
|
||||
<attribute name="t-att-data-report-id">report_xml_id</attribute>
|
||||
</body>
|
||||
</template>
|
||||
</template>
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue