isr_report.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <data>
  4. <record id="paperformat_euro_no_margin" model="report.paperformat">
  5. <field name="name">European A4 without borders</field>
  6. <field name="default" eval="False" />
  7. <field name="format">A4</field>
  8. <field name="orientation">Portrait</field>
  9. <field name="margin_top">0</field>
  10. <field name="margin_bottom">0</field>
  11. <field name="margin_left">0</field>
  12. <field name="margin_right">0</field>
  13. <field name="header_line" eval="False" />
  14. <field name="header_spacing">0</field>
  15. </record>
  16. <!--Report containing an ISR corrresponding to an invoice.-->
  17. <record id="l10n_ch_isr_report" model="ir.actions.report">
  18. <field name="name">ISR</field>
  19. <field name="model">account.move</field>
  20. <field name="report_type">qweb-pdf</field>
  21. <field name="report_name">l10n_ch.isr_report_main</field>
  22. <field name="report_file">l10n_ch.isr_report_main</field>
  23. <field name="print_report_name">'ISR-%s' % object.name</field>
  24. <field name="paperformat_id" ref="paperformat_euro_no_margin"/>
  25. <field name="attachment">'ISR-' + object.name + '.pdf'</field>
  26. <field name="attachment_use">True</field>
  27. </record>
  28. <!--No additional condition in report name on invoice state or type as this
  29. report is only available to be printed for out invoices after
  30. 'draft' state, if the fields required by the ISR have been set.-->
  31. <template id="l10n_ch_isr_report_template">
  32. <t t-call="web.external_layout">
  33. <t t-set="split_total_amount" t-value="invoice.split_total_amount()"/>
  34. <t t-set="print_bank" t-value="invoice.company_id.l10n_ch_isr_print_bank_location"/>
  35. <!-- add class to body tag -->
  36. <script>document.body.className += " l10n_ch_isr";</script>
  37. <!-- since the body content take the whole page we need a way to add margin
  38. back on content outside the ISR so it does not overlap with the header -->
  39. <div id="content_outside_isr">
  40. <h1>ISR for invoice <t t-esc="invoice.name"/></h1>
  41. </div>
  42. <div id="isr" t-att-class="'isr-print-bank' if print_bank else None">
  43. <!--Voucher, left part of the ISR.-->
  44. <div id="voucher">
  45. <!--Einzahlung für/Versement pour/Versamento per-->
  46. <!--If we use the alternate ISR layout, displaying name
  47. and location of the bank.-->
  48. <t t-if="print_bank">
  49. <div id="voucher-for-bank">
  50. <p t-if="not invoice.company_id.l10n_ch_isr_preprinted_bank">
  51. <t t-esc="invoice.partner_bank_id.bank_id.name"/><br />
  52. <t t-esc="invoice.partner_bank_id.bank_id.zip"/>
  53. <t t-esc="invoice.partner_bank_id.bank_id.city"/>
  54. </p>
  55. </div>
  56. <!--Zugunsten von/En faveur de/A favore di-->
  57. </t>
  58. <div id="voucher-for-contact">
  59. <p id="voucher-for_name" t-field="invoice.company_id.display_name"/>
  60. <p id="voucher-for_address1" t-field="invoice.company_id.street"/>
  61. <p id="voucher-for_address2" t-field="invoice.company_id.street2"/>
  62. <p id="voucher-for_address3">
  63. <t t-esc="invoice.company_id.zip"/>
  64. <t t-esc="invoice.company_id.city"/>
  65. </p>
  66. </div>
  67. <div id="voucher-bank" t-if="not print_bank or not invoice.company_id.l10n_ch_isr_preprinted_account">
  68. <!--Konto/Compte/Conto-->
  69. <p id="voucher-bank_ref" t-field="invoice.l10n_ch_isr_subscription_formatted"/>
  70. </div>
  71. <p id="voucher-amount_units" t-esc="split_total_amount[0]"/>
  72. <p id="voucher-amount_cents" t-esc="split_total_amount[1]"/>
  73. <div id="voucher-by">
  74. <!--Einbezahlt von/Versé par/Versato da-->
  75. <p id="voucher-by_reference_number" t-field="invoice.l10n_ch_isr_number"/>
  76. <address id="voucher-by_customer_address" t-field="invoice.partner_id" t-options='{"widget": "contact", "fields": ["address","name"], "no_marker": True}' />
  77. </div>
  78. </div>
  79. <!--Slip, right part of the ISR.-->
  80. <div id="slip">
  81. <!--Einzahlung für/Versement pour/Versamento per-->
  82. <!--If we use the alternate ISR layout, displaying name
  83. and location of the bank.-->
  84. <t t-if="print_bank">
  85. <div id="slip-for-bank">
  86. <p t-if="not invoice.company_id.l10n_ch_isr_preprinted_bank">
  87. <t t-esc="invoice.partner_bank_id.bank_id.name"/><br />
  88. <t t-esc="invoice.partner_bank_id.bank_id.zip"/>
  89. <t t-esc="invoice.partner_bank_id.bank_id.city"/>
  90. </p>
  91. </div>
  92. <!--Zugunsten von/En faveur de/A favore di-->
  93. </t>
  94. <div id="slip-for-contact">
  95. <p id="slip-for_name" t-field="invoice.company_id.display_name"/>
  96. <p id="slip-for_address1" t-field="invoice.company_id.street"/>
  97. <p id="slip-for_address2" t-field="invoice.company_id.street2"/>
  98. <p id="slip-for_address3">
  99. <t t-esc="invoice.company_id.zip"/>
  100. <t t-esc="invoice.company_id.city"/>
  101. </p>
  102. </div>
  103. <div id="slip-bank" t-if="not print_bank or not invoice.company_id.l10n_ch_isr_preprinted_account">
  104. <!--Konto/Compte/Conto-->
  105. <!--aka ISR Subscriber number provided by the financial institution-->
  106. <p id="slip-bank_ref" t-field="invoice.l10n_ch_isr_subscription_formatted"/>
  107. </div>
  108. <p id="slip-amount_units" t-esc="split_total_amount[0]"/>
  109. <p id="slip-amount_cents" t-esc="split_total_amount[1]"/>
  110. <div id="slip-reference">
  111. <!--Referenz-Nr./N°de référence/N°di riferimento-->
  112. <p id="slip-reference_number" t-field="invoice.l10n_ch_isr_number_spaced"/>
  113. </div>
  114. <div id="slip-by">
  115. <!--Einbezahlt von/Versé par/Versato da-->
  116. <address id="slip-by_customer_address" t-field="invoice.partner_id" t-options='{"widget": "contact", "fields": ["address","name"], "no_marker": True}' />
  117. </div>
  118. <div id="slip-optical-line">
  119. <!--Optical reference-->
  120. <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;">
  121. <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"/>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </t>
  127. </template>
  128. <template id="l10n_ch.isr_report_main">
  129. <t t-call="web.html_container">
  130. <t t-foreach="docs" t-as="invoice">
  131. <t t-set="o" t-value="invoice"/>
  132. <t t-call="l10n_ch.l10n_ch_isr_report_template"/>
  133. </t>
  134. </t>
  135. </template>
  136. </data>
  137. </odoo>