odoo-addon-ebill-postfinance 16.0.1.0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. odoo/addons/ebill_postfinance/README.rst +130 -0
  2. odoo/addons/ebill_postfinance/__init__.py +1 -0
  3. odoo/addons/ebill_postfinance/__manifest__.py +35 -0
  4. odoo/addons/ebill_postfinance/data/ir_cron.xml +14 -0
  5. odoo/addons/ebill_postfinance/data/mail_activity_type.xml +10 -0
  6. odoo/addons/ebill_postfinance/data/transmit.method.xml +10 -0
  7. odoo/addons/ebill_postfinance/i18n/ebill_postfinance.pot +533 -0
  8. odoo/addons/ebill_postfinance/messages/invoice-2003A.jinja +238 -0
  9. odoo/addons/ebill_postfinance/messages/invoice-yellowbill.jinja +227 -0
  10. odoo/addons/ebill_postfinance/messages/ybInvoice_V2.0.4.xsd +1395 -0
  11. odoo/addons/ebill_postfinance/models/__init__.py +5 -0
  12. odoo/addons/ebill_postfinance/models/account_move.py +140 -0
  13. odoo/addons/ebill_postfinance/models/ebill_payment_contract.py +73 -0
  14. odoo/addons/ebill_postfinance/models/ebill_postfinance_invoice_message.py +404 -0
  15. odoo/addons/ebill_postfinance/models/ebill_postfinance_service.py +154 -0
  16. odoo/addons/ebill_postfinance/models/sale_order.py +19 -0
  17. odoo/addons/ebill_postfinance/readme/CONFIGURE.rst +13 -0
  18. odoo/addons/ebill_postfinance/readme/CONTRIBUTORS.rst +1 -0
  19. odoo/addons/ebill_postfinance/readme/DESCRIPTION.rst +1 -0
  20. odoo/addons/ebill_postfinance/readme/INSTALL.rst +2 -0
  21. odoo/addons/ebill_postfinance/readme/ROADMAP.rst +10 -0
  22. odoo/addons/ebill_postfinance/readme/USAGE.rst +5 -0
  23. odoo/addons/ebill_postfinance/security/ir.model.access.csv +5 -0
  24. odoo/addons/ebill_postfinance/static/description/icon.png +0 -0
  25. odoo/addons/ebill_postfinance/static/description/index.html +470 -0
  26. odoo/addons/ebill_postfinance/tests/__init__.py +3 -0
  27. odoo/addons/ebill_postfinance/tests/common.py +194 -0
  28. odoo/addons/ebill_postfinance/tests/examples/credit_note_yb.xml +176 -0
  29. odoo/addons/ebill_postfinance/tests/examples/invoice_qr_yb.xml +182 -0
  30. odoo/addons/ebill_postfinance/tests/examples/yellowbill_qr_iban.xml +178 -0
  31. odoo/addons/ebill_postfinance/tests/fixtures/cassettes/test_ping_service.yaml +1057 -0
  32. odoo/addons/ebill_postfinance/tests/fixtures/cassettes/test_search_invoices.yaml +564 -0
  33. odoo/addons/ebill_postfinance/tests/fixtures/cassettes/test_upload_file.yaml +561 -0
  34. odoo/addons/ebill_postfinance/tests/test_ebill_postfinance.py +50 -0
  35. odoo/addons/ebill_postfinance/tests/test_ebill_postfinance_message_yb.py +65 -0
  36. odoo/addons/ebill_postfinance/tests/test_ebill_postfinance_message_yb_creditnote.py +67 -0
  37. odoo/addons/ebill_postfinance/views/ebill_payment_contract.xml +56 -0
  38. odoo/addons/ebill_postfinance/views/ebill_postfinance_invoice_message.xml +81 -0
  39. odoo/addons/ebill_postfinance/views/ebill_postfinance_service.xml +136 -0
  40. odoo/addons/ebill_postfinance/views/message_template.xml +8 -0
  41. odoo_addon_ebill_postfinance-16.0.1.0.0.3.dist-info/METADATA +149 -0
  42. odoo_addon_ebill_postfinance-16.0.1.0.0.3.dist-info/RECORD +44 -0
  43. odoo_addon_ebill_postfinance-16.0.1.0.0.3.dist-info/WHEEL +5 -0
  44. odoo_addon_ebill_postfinance-16.0.1.0.0.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,238 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <!DOCTYPE XML-FSCM-INVOICE-2003A SYSTEM "XML-FSCM-INVOICE-2003A.DTD">
3
+ <XML-FSCM-INVOICE-2003A>
4
+ <INTERCHANGE>
5
+ <IC-SENDER>
6
+ <Pid>{{ client_pid }}</Pid>
7
+ </IC-SENDER>
8
+ <IC-RECEIVER>
9
+ <Pid>41010106799303734</Pid>
10
+ </IC-RECEIVER>
11
+ <IC-Ref>{{ transaction_id }}</IC-Ref>
12
+ </INTERCHANGE>
13
+ <INVOICE Type="{{ document_type }}">
14
+ <HEADER>
15
+ <FUNCTION-FLAGS>
16
+ <Confirmation-Flag />
17
+ </FUNCTION-FLAGS>
18
+ <MESSAGE-REFERENCE>
19
+ <REFERENCE-DATE>
20
+ <Reference-No>{{ invoice.name }}</Reference-No>
21
+ <Date Format="CCYYMMDD">{{ format_date() }}</Date>
22
+ </REFERENCE-DATE>
23
+ </MESSAGE-REFERENCE>
24
+ <PRINT-DATE>
25
+ <Date Format="CCYYMMDD">{{ format_date(invoice.date_invoice) }}</Date>
26
+ </PRINT-DATE>
27
+ <DELIVERY-DATE>
28
+ <Date Format="CCYYMMDD">{{ format_date(invoice.date_invoice) }}</Date>
29
+ </DELIVERY-DATE>
30
+ <REFERENCE>
31
+ <INVOICE-REFERENCE>
32
+ <REFERENCE-DATE>
33
+ <Reference-No>{{ invoice.name }}</Reference-No>
34
+ <Date Format="CCYYMMDD">{{ format_date(invoice.date_invoice) }}</Date>
35
+ </REFERENCE-DATE>
36
+ </INVOICE-REFERENCE>
37
+ {% for order in invoice_lines.sale_line_ids.mapped('order_id') if order.postfinance_ebill_client_order_ref %}
38
+ {%- if loop.index0 < 5 %}
39
+ <ORDER>
40
+ <REFERENCE-DATE>
41
+ <Reference-No>{{ order.postfinance_ebill_client_order_ref }}</Reference-No>
42
+ <Date Format="CCYYMMDD">{{ format_date(order.date_order) }}</Date>
43
+ </REFERENCE-DATE>
44
+ </ORDER>
45
+ {%- endif %}
46
+ {% endfor %}
47
+ {% for picking in invoice_lines.sale_line_ids.move_ids.mapped('picking_id')[:9] %}
48
+ {%- if picking.state != 'cancel' %}
49
+ <DELIVERY-NOTE>
50
+ <REFERENCE-DATE>
51
+ <Reference-No>{{ picking.name }}</Reference-No>
52
+ {%- if picking.date_done %}
53
+ <Date Format="CCYYMMDD">{{ format_date(picking.date_done) }}</Date>
54
+ {%- endif %}
55
+ </REFERENCE-DATE>
56
+ </DELIVERY-NOTE>
57
+ {%- endif %}
58
+ {% endfor %}
59
+ {% for ref in invoice.get_postfinance_other_reference() %}
60
+ <OTHER-REFERENCE Type="{{ ref.type }}">
61
+ <REFERENCE-DATE>
62
+ <Reference-No>{{ ref.no|truncate(35, True, "") }}</Reference-No>
63
+ </REFERENCE-DATE>
64
+ </OTHER-REFERENCE>
65
+ {% endfor %}
66
+ </REFERENCE>
67
+ <BILLER>
68
+ {#- Doc says vat number or business identitfiaction number #}
69
+ {%- if invoice.company_id.vat %}
70
+ <Tax-No>{{ invoice.company_id.vat }}</Tax-No>
71
+ {%- endif %}
72
+ {%- if invoice.payment_reference %}
73
+ <Doc-Reference Type="{{ 'QRR' if payment_type == 'qr' else 'ESR-NEU' }}">{{ invoice.payment_reference }}</Doc-Reference>
74
+ {%- endif %}
75
+ <PARTY-ID>
76
+ <Pid>{{ client_pid }}</Pid>
77
+ </PARTY-ID>
78
+ <NAME-ADDRESS Format="COM">
79
+ <NAME>
80
+ <Line-35>{{ biller.name }}</Line-35>
81
+ </NAME>
82
+ <STREET>
83
+ <Line-35>{{ (biller.street or '')|truncate(35, True, "") }}</Line-35>
84
+ {%- if biller.street2 %}
85
+ <Line-35>{{ biller.street2|truncate(5, True, "") }}</Line-35>
86
+ {% endif %}
87
+ </STREET>
88
+ <City>{{ biller.city or ''}}</City>
89
+ <Zip>{{ biller.zip or '' }}</Zip>
90
+ <Country>{{ biller.country_id.code or 'CH' }}</Country>
91
+ </NAME-ADDRESS>
92
+ <BANK-INFO>
93
+ {%- if payment_type in ['isr', 'esp'] %}
94
+ <Acct-No>{{ bank_account }}</Acct-No>
95
+ <BankId Type="BCNr-int" Country="CH">{{ bank.bank_id.clearing }}</BankId>
96
+ {%- elif payment_type == 'qr' %}
97
+ <Acct-No>{{ bank_account }}</Acct-No>
98
+ <BankId Type="IID" Country="CH">{{ bank_account[4:9] if bank_account else ''}}</BankId>
99
+ {%- endif %}
100
+ </BANK-INFO>
101
+ </BILLER>
102
+ <PAYER>
103
+ <PARTY-ID>
104
+ <Pid>{{ ebill_account_number }}</Pid>
105
+ </PARTY-ID>
106
+ <NAME-ADDRESS Format="COM">
107
+ <NAME>
108
+ {%- if customer.name != customer.commercial_company_name and customer.commercial_company_name %}
109
+ <Line-35>{{ customer.commercial_company_name|truncate(35, True, '') }}</Line-35>
110
+ {%- endif %}
111
+ <Line-35>{{ (customer.name or "")|truncate(35, True, "") }}</Line-35>
112
+ </NAME>
113
+ <STREET>
114
+ <Line-35>{{ (customer.street or "")|truncate(35, True, "") }}</Line-35>
115
+ {%- if customer.street2 %}
116
+ <Line-35>{{ customer.street2|truncate(35, True, "") }}</Line-35>
117
+ {%- endif %}
118
+ </STREET>
119
+ <City>{{ customer.city or ""}}</City>
120
+ <Zip>{{ customer.zip or ""}}</Zip>
121
+ <Country>{{ customer.country_id.code or 'CH' }}</Country>
122
+ </NAME-ADDRESS>
123
+ </PAYER>
124
+ {%- if delivery %}
125
+ <DELIVERY-PARTY>
126
+ <NAME-ADDRESS Format="COM">
127
+ <NAME>
128
+ {%- if delivery.name != delivery.commercial_company_name and delivery.commercial_company_name %}
129
+ <Line-35>{{ delivery.commercial_company_name|truncate(35, True, '') }}</Line-35>
130
+ {%- endif %}
131
+ <Line-35>{{ (delivery.name or "")|truncate(35, True, "") }}</Line-35>
132
+ </NAME>
133
+ <STREET>
134
+ <Line-35>{{ (delivery.street or "")|truncate(35, True, "") }}</Line-35>
135
+ {%- if delivery.street2 %}
136
+ <Line-35>{{ delivery.street2|truncate(35, True, "") }}</Line-35>
137
+ {%- endif %}
138
+ </STREET>
139
+ <City>{{ delivery.city or '' }}</City>
140
+ <Zip>{{ delivery.zip or '' }}</Zip>
141
+ <Country>{{ delivery.country_id.code or 'CH' }}</Country>
142
+ </NAME-ADDRESS>
143
+ </DELIVERY-PARTY>
144
+ {%- endif %}
145
+ </HEADER>
146
+ {% for line in invoice_lines %}
147
+ <LINE-ITEM Line-Number="{{ loop.index }}">
148
+ {%- if line.product_id %}
149
+ <ITEM-ID>
150
+ <Item-Id Type="VN">{{ line.product_id.default_code or ''}}</Item-Id>
151
+ <Item-Id Type="SA">{{ line.product_id.default_code or ''}}</Item-Id>
152
+ </ITEM-ID>
153
+ {%- endif %}
154
+ <ITEM-DESCRIPTION>
155
+ <Item-Type-Code>1011</Item-Type-Code>
156
+ <Line-35>{{ (line.product_id.name or line.name or "")[:35] }}</Line-35>
157
+ {%- if (line.product_id.name or line.name or "")|length > 35 %}
158
+ <Line-35>{{ (line.product_id.name or line.name)[35:]|truncate(34, True) }}</Line-35>
159
+ {%- endif %}
160
+ </ITEM-DESCRIPTION>
161
+ {% for order in invoice_lines.sale_line_ids.mapped('order_id') %}
162
+ {%- if order.postfinance_ebill_client_order_ref %}
163
+ <ITEM-REFERENCE Type="ON">
164
+ <REFERENCE-DATE>
165
+ <Reference-No>{{ order.postfinance_ebill_client_order_ref }}</Reference-No>
166
+ <Date Format="CCYYMMDD">{{ format_date(order.date_order) }}</Date>
167
+ </REFERENCE-DATE>
168
+ </ITEM-REFERENCE>
169
+ {%- endif %}
170
+ {% endfor %}
171
+ <Quantity Type="47" Units="PCE">{{ line.quantity }}</Quantity>
172
+ <Price Type="YYY">{{ line.price_subtotal|round(2) }}</Price>
173
+ <Price Type="AAA">{{ line.price_subtotal|round(2) }}</Price>
174
+ <Price Type="XXX">{{ line.price_total|round(2) }}</Price>
175
+ <ITEM-AMOUNT Type="66">
176
+ <Amount Currency="{{ invoice.currency_id.name }}">{{ line.price_subtotal|round(2) }}</Amount>
177
+ </ITEM-AMOUNT>
178
+ {% for tax in line.tax_ids %}
179
+ {%- if loop.index == 1 %}
180
+ <TAX>
181
+ <Rate>{{ tax.amount}}</Rate>
182
+ <Amount Currency="{{ invoice.currency_id.name }}">{{ tax._compute_amount(line.price_subtotal, line.price_unit)|round(2) }}</Amount>
183
+ </TAX>
184
+ {%- endif %}
185
+ {% else %}
186
+ <TAX>
187
+ <Rate>0</Rate>
188
+ </TAX>
189
+ {% endfor %}
190
+ </LINE-ITEM>
191
+ {% endfor %}
192
+ <SUMMARY>
193
+ <INVOICE-AMOUNT Print-Status="25">
194
+ <Amount Currency="{{ invoice.currency_id.name }}">{{ invoice.amount_total|round(2) }}</Amount>
195
+ </INVOICE-AMOUNT>
196
+ <VAT-AMOUNT Print-Status="25">
197
+ <Amount Currency="{{ invoice.currency_id.name }}">{{ invoice.amount_tax|round(2) }}</Amount>
198
+ </VAT-AMOUNT>
199
+ <EXTENDED-AMOUNT Type="79">
200
+ <Amount Currency="{{ invoice.currency_id.name }}">{{ invoice.amount_untaxed|round(2) }}</Amount>
201
+ </EXTENDED-AMOUNT>
202
+ {% if amount_by_group %}
203
+ {% for taxgroup in amount_by_group %}
204
+ <TAX>
205
+ <TAX-BASIS>
206
+ <Amount Currency="{{ invoice.currency_id.name }}">{{ taxgroup[2]|round(2) }}</Amount>
207
+ </TAX-BASIS>
208
+ {%- if taxgroup[0] %}
209
+ <Rate Category="S">{{ taxgroup[0] }}</Rate>
210
+ {%- else %}
211
+ <Rate Category="E">0</Rate>
212
+ {%- endif %}
213
+ <Amount Currency="{{ invoice.currency_id.name }}">{{ taxgroup[1]|round(2) }}</Amount>
214
+ </TAX>
215
+ {% endfor %}
216
+ {%- else %}
217
+ <TAX>
218
+ <TAX-BASIS>
219
+ <Amount Currency="{{ invoice.currency_id.name }}">{{ invoice.amount_untaxed|round(2) }}</Amount>
220
+ </TAX-BASIS>
221
+ <Rate Category="E">0</Rate>
222
+ <Amount Currency="{{ invoice.currency_id.name }}">0</Amount>
223
+ </TAX>
224
+ {% endif -%}
225
+ <PAYMENT-TERMS>
226
+ <BASIC Payment-Type="{{ 'ESR' if payment_type == 'isr' else payment_type|upper }}" Terms-Type="5">
227
+ <TERMS>
228
+ <Date>{{ date_due }}</Date>
229
+ </TERMS>
230
+ </BASIC>
231
+ {% include discount_template ignore missing %}
232
+ </PAYMENT-TERMS>
233
+ <Back-Pack-Container Encode="Base64">
234
+ {{- pdf_data | safe -}}
235
+ </Back-Pack-Container>
236
+ </SUMMARY>
237
+ </INVOICE>
238
+ </XML-FSCM-INVOICE-2003A>
@@ -0,0 +1,227 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" type="string">
3
+ <Header>
4
+ <From>{{ invoice.company_id.name }}</From>
5
+ <To>IPECeBILLServer</To>
6
+ <UseCase>CreateybInvoice</UseCase>
7
+ <SessionID>1</SessionID>
8
+ <Version>2.0</Version>
9
+ <Status>0</Status>
10
+ <SoftwareName>Odoo</SoftwareName>
11
+ <SoftwareVersion>14.0</SoftwareVersion>
12
+ </Header>
13
+ <Body>
14
+ {% set ref = namespace(position = 0) %}
15
+ <DeliveryInfo>
16
+ <BillerID>{{ message.service_id.biller_id }}</BillerID>
17
+ <eBillAccountID>{{ ebill_account_number }}</eBillAccountID>
18
+ <DeliveryDate>{{ format_date(invoice.date_invoice) }}</DeliveryDate>
19
+ <TransactionID>{{ transaction_id }}</TransactionID>
20
+ <BillDetailsType>PDFAppendix</BillDetailsType>
21
+ <URLBillDetails/>
22
+ </DeliveryInfo>
23
+ <Bill>
24
+ <Header>
25
+ <DocumentType>{{ 'BILL' if invoice.move_type == 'out_invoice' else 'CREDITADVICE' }}</DocumentType>
26
+ <DocumentID>{{ invoice.name }}</DocumentID>
27
+ <DocumentDate>{{ format_date(invoice.date_invoice) }}</DocumentDate>
28
+ <SenderParty>
29
+ <TaxLiability>VAT</TaxLiability>
30
+ <PartyType>
31
+ <Address>
32
+ <CompanyName>{{ biller.name }}</CompanyName>
33
+ <Address1>{{ (biller.street or "")|truncate(50, True, "") }}</Address1>
34
+ {%- if biller.street2 %}
35
+ <Address2>{{ (biller.street2)|truncate(50, True, "") }}</Address2>
36
+ {%- endif %}
37
+ <ZIP>{{ biller.zip or "" }}</ZIP>
38
+ <City>{{ biller.city or "" }}</City>
39
+ <Country>{{ biller.country_id.code or 'CH' }}</Country>
40
+ {%- if biller.email %}
41
+ <Email>{{ biller.email }}</Email>
42
+ {%- endif %}
43
+ {%- if biller.phone %}
44
+ <Contact1>{{ biller.phone }}</Contact1>
45
+ {%- endif %}
46
+ {%- if biller.mobile %}
47
+ <Contact2>{{ biller.mobile }}</Contact2>
48
+ {%- endif %}
49
+ </Address>
50
+ {%- if invoice.company_id.vat %}
51
+ <TaxID>{{ invoice.company_id.vat|replace("-", "")|replace(".", "") }}</TaxID>
52
+ {%- endif %}
53
+ </PartyType>
54
+ </SenderParty>
55
+ <ReceiverParty>
56
+ <PartyType>
57
+ <CustomerID>{{ customer.id }}</CustomerID>
58
+ <Address>
59
+ <CompanyName>{{ (customer.commercial_company_name or customer.name)|truncate(50, True, "") }}</CompanyName>
60
+ <Address1>{{ (customer.street or "")|truncate(50, True, "") }}</Address1>
61
+ {%- if customer.street2 %}
62
+ <Address2>{{ (customer.street2)|truncate(50, True, "") }}</Address2>
63
+ {%- endif %}
64
+ <ZIP>{{ customer.zip or "" }}</ZIP>
65
+ <City>{{ customer.city or "" }}</City>
66
+ <Country>{{ customer.country_id.code or 'CH' }}</Country>
67
+ {%- if customer.email %}
68
+ <Email>{{ customer.email }}</Email>
69
+ {%- endif %}
70
+ {%- if customer.phone %}
71
+ <Contact1>{{ customer.phone }}</Contact1>
72
+ {%- endif %}
73
+ {%- if customer.mobile %}
74
+ <Contact2>{{ customer.mobile }}</Contact2>
75
+ {%- endif %}
76
+ </Address>
77
+ {# {%- if invoice.company_id.vat %} #}
78
+ {# <TaxID>{{ invoice.company_id.vat|replace("-", "")|replace(".", "") }}</TaxID> #}
79
+ {# {%- endif %} #}
80
+ </PartyType>
81
+ </ReceiverParty>
82
+ {%- if False %}
83
+ {# So is this where the invoice is sent and not who it is for ? #}
84
+ <InvoiceReceivingParty>
85
+ <Address>
86
+ </Address>
87
+ </InvoiceReceivingParty>
88
+ {%- endif %}
89
+ {%- if delivery %}
90
+ <DeliveryPlace>
91
+ <Address>
92
+ <CompanyName>{{ (delivery.commercial_company_name or delivery.name)|truncate(50, True, "") }}</CompanyName>
93
+ <ZIP>{{ delivery.zip or "" }}</ZIP>
94
+ <City>{{ delivery.city or "" }}</City>
95
+ <Country>{{ delivery.country_id.code or 'CH' }}</Country>
96
+ {%- if delivery.email %}
97
+ <Email>{{ delivery.email }}</Email>
98
+ {%- endif %}
99
+ {%- if delivery.phone %}
100
+ <Contact1>{{ delivery.phone }}</Contact1>
101
+ {%- endif %}
102
+ {%- if delivery.mobile %}
103
+ <Contact2>{{ delivery.mobile }}</Contact2>
104
+ {%- endif %}
105
+ </Address>
106
+ </DeliveryPlace>
107
+ {%- endif %}
108
+ <AchievementDate>
109
+ {# Not sure what is this ? #}
110
+ <StartDateAchievement>{{ format_date(invoice.date_invoice) }}</StartDateAchievement>
111
+ <EndDateAchievement>{{ format_date(invoice.date_invoice) }}</EndDateAchievement>
112
+ </AchievementDate>
113
+ <Currency>{{ invoice.currency_id.name }}</Currency>
114
+ <AccountAssignment>
115
+
116
+ {%- if saleorder|length == 1 %}
117
+ {% if saleorder.postfinance_ebill_client_order_ref %}
118
+ {% set ref.position = ref.position + 1 %}
119
+ <OrderReference>
120
+ <ReferencePosition>{{ ref.position }}</ReferencePosition>
121
+ <ReferenceType>OrderReference</ReferenceType>
122
+ <ReferenceValue>{{ saleorder.postfinance_ebill_client_order_ref }}</ReferenceValue>
123
+ </OrderReference>
124
+ {%- endif %}
125
+ <OrderDate>{{ format_date(saleorder.date_order) }}</OrderDate>
126
+ {%- endif %}
127
+
128
+ </AccountAssignment>
129
+ <Language>{{ (customer.lang or "en")|truncate(2, True, "") }}</Language>
130
+ <PaymentInformation>
131
+ <PaymentDueDate>{{ date_due }}</PaymentDueDate>
132
+ <PaymentType>{{ payment_type|upper }}</PaymentType>
133
+ <fixAmount>Yes</fixAmount>
134
+ {% if payment_type == 'iban' %}
135
+ <IBAN>
136
+ {%- if bank.bank_id.bic %}
137
+ <BIC>{{ bank.bank_id.bic }}</BIC>
138
+ {%- endif %}
139
+ <BankName>{{ bank.bank_id.name[:50] }}</BankName>
140
+ <IBAN>{{ bank_account }}</IBAN>
141
+ {%- if invoice.payment_reference %}
142
+ <CreditorReference>{{ invoice.payment_reference }}</CreditorReference>
143
+ {%- endif %}
144
+ </IBAN>
145
+ {%- endif %}
146
+ </PaymentInformation>
147
+ </Header>
148
+ <LineItems>
149
+ {% for line in invoice_lines %}
150
+ <LineItem>
151
+ {# discount, shipping and rounding go here too #}
152
+ <LineItemType>NORMAL</LineItemType>
153
+ <LineItemID>{{ loop.index }}</LineItemID>
154
+ <ProductDescription>{{ (line.product_id.name or line.name or "")[:255] }}</ProductDescription>
155
+ {%- if line.product_id %}
156
+ <ProductID>{{ line.product_id.default_code or ''}}</ProductID>
157
+ {%- endif %}
158
+ <Quantity>{{ line.quantity or 0 }}</Quantity>
159
+ <QuantityDescription>{{ line.product_uom_id.name or "PCE"}}</QuantityDescription>
160
+ <PriceUnit>1</PriceUnit>
161
+ {% for tax in line.tax_ids %}
162
+ {%- if loop.index == 1 %}
163
+ <Tax>
164
+ <TaxDetail>
165
+ <Rate>{{ tax.amount|round(2)|replace(",", ".") }}</Rate>
166
+ <Amount>{{ tax._compute_amount(line.price_subtotal, line.price_unit)|round(2) }}</Amount>
167
+ <BaseAmountExclusiveTax>{{ line.price_subtotal|round(6) }}</BaseAmountExclusiveTax>
168
+ <BaseAmountInclusiveTax>{{ line.price_total|round(6) }}</BaseAmountInclusiveTax>
169
+ </TaxDetail>
170
+ <TotalTax>{{ tax._compute_amount(line.price_subtotal, line.price_unit)|round(2) }}</TotalTax>
171
+ </Tax>
172
+ {%- endif %}
173
+ {% endfor %}
174
+ <AmountInclusiveTax>{{ line.price_total|round(6) }}</AmountInclusiveTax>
175
+ <AmountExclusiveTax>{{ line.price_subtotal|round(6) }}</AmountExclusiveTax>
176
+
177
+ {% for order in line.sale_line_ids.mapped('order_id') %}
178
+ {% set ref.position = ref.position + 1 %}
179
+ <FixedReference>
180
+ <ReferencePosition>{{ ref.position }}</ReferencePosition>
181
+ <ReferenceType>OrderNumberBySupplier</ReferenceType>
182
+ <ReferenceValue>{{ order.name }}</ReferenceValue>
183
+ </FixedReference>
184
+ {%- if order.postfinance_ebill_client_order_ref %}
185
+ {% set ref.position = ref.position + 1 %}
186
+ <FixedReference>
187
+ <ReferencePosition>{{ ref.position }}</ReferencePosition>
188
+ <ReferenceType>OrderNumberByBuyer</ReferenceType>
189
+ <ReferenceValue>{{ order.postfinance_ebill_client_order_ref }}</ReferenceValue>
190
+ </FixedReference>
191
+ {%- endif %}
192
+ {% endfor %}
193
+
194
+ {% include invoice_line_stock_template ignore missing %}
195
+
196
+ </LineItem>
197
+ {% endfor %}
198
+ </LineItems>
199
+ <Summary>
200
+ {% if amount_by_group %}
201
+ <Tax>
202
+ {% for taxgroup in amount_by_group %}
203
+ <TaxDetail>
204
+ <Rate>{{ taxgroup[0]|replace(",", ".") or "0" }}</Rate>
205
+ <Amount>{{ taxgroup[1]|round(2)|round(6) * amount_sign }}</Amount>
206
+ <BaseAmountExclusiveTax>{{ taxgroup[2]|round(6) * amount_sign }}</BaseAmountExclusiveTax>
207
+ <BaseAmountInclusiveTax>{{ (taxgroup[2]|round(6) + taxgroup[1]|round(6)) * amount_sign }}</BaseAmountInclusiveTax>
208
+ </TaxDetail>
209
+ {% endfor %}
210
+ <TotalTax>{{ invoice.amount_tax|round(6) }}</TotalTax>
211
+ </Tax>
212
+ {% endif -%}
213
+ {# <Discount> #}
214
+ {# <Days></Days> #}
215
+ {# <Rate></Rate> #}
216
+ {# </Discount> #}
217
+ <TotalAmountExclusiveTax>{{ invoice.amount_untaxed * amount_sign }}</TotalAmountExclusiveTax>
218
+ <TotalAmountInclusiveTax>{{ invoice.amount_total * amount_sign }}</TotalAmountInclusiveTax>
219
+ {# <TotalAmountPaid></TotalAmountPaid> #}
220
+ <TotalAmountDue>{{ invoice.amount_total * amount_sign }}</TotalAmountDue>
221
+ </Summary>
222
+ </Bill>
223
+ <Appendix>
224
+ <Document MimeType="x-application/pdfappendix">{{- pdf_data | safe -}}</Document>
225
+ </Appendix>
226
+ </Body>
227
+ </Envelope>