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,470 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
7
+ <title>eBill Postfinance</title>
8
+ <style type="text/css">
9
+
10
+ /*
11
+ :Author: David Goodger (goodger@python.org)
12
+ :Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
13
+ :Copyright: This stylesheet has been placed in the public domain.
14
+
15
+ Default cascading style sheet for the HTML output of Docutils.
16
+
17
+ See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
18
+ customize this style sheet.
19
+ */
20
+
21
+ /* used to remove borders from tables and images */
22
+ .borderless, table.borderless td, table.borderless th {
23
+ border: 0 }
24
+
25
+ table.borderless td, table.borderless th {
26
+ /* Override padding for "table.docutils td" with "! important".
27
+ The right padding separates the table cells. */
28
+ padding: 0 0.5em 0 0 ! important }
29
+
30
+ .first {
31
+ /* Override more specific margin styles with "! important". */
32
+ margin-top: 0 ! important }
33
+
34
+ .last, .with-subtitle {
35
+ margin-bottom: 0 ! important }
36
+
37
+ .hidden {
38
+ display: none }
39
+
40
+ .subscript {
41
+ vertical-align: sub;
42
+ font-size: smaller }
43
+
44
+ .superscript {
45
+ vertical-align: super;
46
+ font-size: smaller }
47
+
48
+ a.toc-backref {
49
+ text-decoration: none ;
50
+ color: black }
51
+
52
+ blockquote.epigraph {
53
+ margin: 2em 5em ; }
54
+
55
+ dl.docutils dd {
56
+ margin-bottom: 0.5em }
57
+
58
+ object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
59
+ overflow: hidden;
60
+ }
61
+
62
+ /* Uncomment (and remove this text!) to get bold-faced definition list terms
63
+ dl.docutils dt {
64
+ font-weight: bold }
65
+ */
66
+
67
+ div.abstract {
68
+ margin: 2em 5em }
69
+
70
+ div.abstract p.topic-title {
71
+ font-weight: bold ;
72
+ text-align: center }
73
+
74
+ div.admonition, div.attention, div.caution, div.danger, div.error,
75
+ div.hint, div.important, div.note, div.tip, div.warning {
76
+ margin: 2em ;
77
+ border: medium outset ;
78
+ padding: 1em }
79
+
80
+ div.admonition p.admonition-title, div.hint p.admonition-title,
81
+ div.important p.admonition-title, div.note p.admonition-title,
82
+ div.tip p.admonition-title {
83
+ font-weight: bold ;
84
+ font-family: sans-serif }
85
+
86
+ div.attention p.admonition-title, div.caution p.admonition-title,
87
+ div.danger p.admonition-title, div.error p.admonition-title,
88
+ div.warning p.admonition-title, .code .error {
89
+ color: red ;
90
+ font-weight: bold ;
91
+ font-family: sans-serif }
92
+
93
+ /* Uncomment (and remove this text!) to get reduced vertical space in
94
+ compound paragraphs.
95
+ div.compound .compound-first, div.compound .compound-middle {
96
+ margin-bottom: 0.5em }
97
+
98
+ div.compound .compound-last, div.compound .compound-middle {
99
+ margin-top: 0.5em }
100
+ */
101
+
102
+ div.dedication {
103
+ margin: 2em 5em ;
104
+ text-align: center ;
105
+ font-style: italic }
106
+
107
+ div.dedication p.topic-title {
108
+ font-weight: bold ;
109
+ font-style: normal }
110
+
111
+ div.figure {
112
+ margin-left: 2em ;
113
+ margin-right: 2em }
114
+
115
+ div.footer, div.header {
116
+ clear: both;
117
+ font-size: smaller }
118
+
119
+ div.line-block {
120
+ display: block ;
121
+ margin-top: 1em ;
122
+ margin-bottom: 1em }
123
+
124
+ div.line-block div.line-block {
125
+ margin-top: 0 ;
126
+ margin-bottom: 0 ;
127
+ margin-left: 1.5em }
128
+
129
+ div.sidebar {
130
+ margin: 0 0 0.5em 1em ;
131
+ border: medium outset ;
132
+ padding: 1em ;
133
+ background-color: #ffffee ;
134
+ width: 40% ;
135
+ float: right ;
136
+ clear: right }
137
+
138
+ div.sidebar p.rubric {
139
+ font-family: sans-serif ;
140
+ font-size: medium }
141
+
142
+ div.system-messages {
143
+ margin: 5em }
144
+
145
+ div.system-messages h1 {
146
+ color: red }
147
+
148
+ div.system-message {
149
+ border: medium outset ;
150
+ padding: 1em }
151
+
152
+ div.system-message p.system-message-title {
153
+ color: red ;
154
+ font-weight: bold }
155
+
156
+ div.topic {
157
+ margin: 2em }
158
+
159
+ h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
160
+ h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
161
+ margin-top: 0.4em }
162
+
163
+ h1.title {
164
+ text-align: center }
165
+
166
+ h2.subtitle {
167
+ text-align: center }
168
+
169
+ hr.docutils {
170
+ width: 75% }
171
+
172
+ img.align-left, .figure.align-left, object.align-left, table.align-left {
173
+ clear: left ;
174
+ float: left ;
175
+ margin-right: 1em }
176
+
177
+ img.align-right, .figure.align-right, object.align-right, table.align-right {
178
+ clear: right ;
179
+ float: right ;
180
+ margin-left: 1em }
181
+
182
+ img.align-center, .figure.align-center, object.align-center {
183
+ display: block;
184
+ margin-left: auto;
185
+ margin-right: auto;
186
+ }
187
+
188
+ table.align-center {
189
+ margin-left: auto;
190
+ margin-right: auto;
191
+ }
192
+
193
+ .align-left {
194
+ text-align: left }
195
+
196
+ .align-center {
197
+ clear: both ;
198
+ text-align: center }
199
+
200
+ .align-right {
201
+ text-align: right }
202
+
203
+ /* reset inner alignment in figures */
204
+ div.align-right {
205
+ text-align: inherit }
206
+
207
+ /* div.align-center * { */
208
+ /* text-align: left } */
209
+
210
+ .align-top {
211
+ vertical-align: top }
212
+
213
+ .align-middle {
214
+ vertical-align: middle }
215
+
216
+ .align-bottom {
217
+ vertical-align: bottom }
218
+
219
+ ol.simple, ul.simple {
220
+ margin-bottom: 1em }
221
+
222
+ ol.arabic {
223
+ list-style: decimal }
224
+
225
+ ol.loweralpha {
226
+ list-style: lower-alpha }
227
+
228
+ ol.upperalpha {
229
+ list-style: upper-alpha }
230
+
231
+ ol.lowerroman {
232
+ list-style: lower-roman }
233
+
234
+ ol.upperroman {
235
+ list-style: upper-roman }
236
+
237
+ p.attribution {
238
+ text-align: right ;
239
+ margin-left: 50% }
240
+
241
+ p.caption {
242
+ font-style: italic }
243
+
244
+ p.credits {
245
+ font-style: italic ;
246
+ font-size: smaller }
247
+
248
+ p.label {
249
+ white-space: nowrap }
250
+
251
+ p.rubric {
252
+ font-weight: bold ;
253
+ font-size: larger ;
254
+ color: maroon ;
255
+ text-align: center }
256
+
257
+ p.sidebar-title {
258
+ font-family: sans-serif ;
259
+ font-weight: bold ;
260
+ font-size: larger }
261
+
262
+ p.sidebar-subtitle {
263
+ font-family: sans-serif ;
264
+ font-weight: bold }
265
+
266
+ p.topic-title {
267
+ font-weight: bold }
268
+
269
+ pre.address {
270
+ margin-bottom: 0 ;
271
+ margin-top: 0 ;
272
+ font: inherit }
273
+
274
+ pre.literal-block, pre.doctest-block, pre.math, pre.code {
275
+ margin-left: 2em ;
276
+ margin-right: 2em }
277
+
278
+ pre.code .ln { color: grey; } /* line numbers */
279
+ pre.code, code { background-color: #eeeeee }
280
+ pre.code .comment, code .comment { color: #5C6576 }
281
+ pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
282
+ pre.code .literal.string, code .literal.string { color: #0C5404 }
283
+ pre.code .name.builtin, code .name.builtin { color: #352B84 }
284
+ pre.code .deleted, code .deleted { background-color: #DEB0A1}
285
+ pre.code .inserted, code .inserted { background-color: #A3D289}
286
+
287
+ span.classifier {
288
+ font-family: sans-serif ;
289
+ font-style: oblique }
290
+
291
+ span.classifier-delimiter {
292
+ font-family: sans-serif ;
293
+ font-weight: bold }
294
+
295
+ span.interpreted {
296
+ font-family: sans-serif }
297
+
298
+ span.option {
299
+ white-space: nowrap }
300
+
301
+ span.pre {
302
+ white-space: pre }
303
+
304
+ span.problematic {
305
+ color: red }
306
+
307
+ span.section-subtitle {
308
+ /* font-size relative to parent (h1..h6 element) */
309
+ font-size: 80% }
310
+
311
+ table.citation {
312
+ border-left: solid 1px gray;
313
+ margin-left: 1px }
314
+
315
+ table.docinfo {
316
+ margin: 2em 4em }
317
+
318
+ table.docutils {
319
+ margin-top: 0.5em ;
320
+ margin-bottom: 0.5em }
321
+
322
+ table.footnote {
323
+ border-left: solid 1px black;
324
+ margin-left: 1px }
325
+
326
+ table.docutils td, table.docutils th,
327
+ table.docinfo td, table.docinfo th {
328
+ padding-left: 0.5em ;
329
+ padding-right: 0.5em ;
330
+ vertical-align: top }
331
+
332
+ table.docutils th.field-name, table.docinfo th.docinfo-name {
333
+ font-weight: bold ;
334
+ text-align: left ;
335
+ white-space: nowrap ;
336
+ padding-left: 0 }
337
+
338
+ /* "booktabs" style (no vertical lines) */
339
+ table.docutils.booktabs {
340
+ border: 0px;
341
+ border-top: 2px solid;
342
+ border-bottom: 2px solid;
343
+ border-collapse: collapse;
344
+ }
345
+ table.docutils.booktabs * {
346
+ border: 0px;
347
+ }
348
+ table.docutils.booktabs th {
349
+ border-bottom: thin solid;
350
+ text-align: left;
351
+ }
352
+
353
+ h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
354
+ h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
355
+ font-size: 100% }
356
+
357
+ ul.auto-toc {
358
+ list-style-type: none }
359
+
360
+ </style>
361
+ </head>
362
+ <body>
363
+ <div class="document" id="ebill-postfinance">
364
+ <h1 class="title">eBill Postfinance</h1>
365
+
366
+ <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367
+ !! This file is generated by oca-gen-addon-readme !!
368
+ !! changes will be overwritten. !!
369
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
+ !! source digest: sha256:8fe54c201370aabd37f966becd9bc102925267307e434f56a4c558a943f058ed
371
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
+ <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/16.0/ebill_postfinance"><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-16-0/l10n-switzerland-16-0-ebill_postfinance"><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=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
+ <p>This module implements the exchange of electronic invoices with the Postfinance web service.</p>
374
+ <p><strong>Table of contents</strong></p>
375
+ <div class="contents local topic" id="contents">
376
+ <ul class="simple">
377
+ <li><a class="reference internal" href="#installation" id="toc-entry-1">Installation</a></li>
378
+ <li><a class="reference internal" href="#configuration" id="toc-entry-2">Configuration</a></li>
379
+ <li><a class="reference internal" href="#create-a-service" id="toc-entry-3">Create a service</a></li>
380
+ <li><a class="reference internal" href="#configure-a-customer-and-create-his-contract" id="toc-entry-4">Configure a customer and create his contract</a></li>
381
+ <li><a class="reference internal" href="#usage" id="toc-entry-5">Usage</a></li>
382
+ <li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-6">Known issues / Roadmap</a></li>
383
+ <li><a class="reference internal" href="#bug-tracker" id="toc-entry-7">Bug Tracker</a></li>
384
+ <li><a class="reference internal" href="#credits" id="toc-entry-8">Credits</a><ul>
385
+ <li><a class="reference internal" href="#authors" id="toc-entry-9">Authors</a></li>
386
+ <li><a class="reference internal" href="#contributors" id="toc-entry-10">Contributors</a></li>
387
+ <li><a class="reference internal" href="#maintainers" id="toc-entry-11">Maintainers</a></li>
388
+ </ul>
389
+ </li>
390
+ </ul>
391
+ </div>
392
+ <div class="section" id="installation">
393
+ <h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
394
+ <p>This module needs the Python library <cite>ebilling_postfiance</cite> which can be installed from Pypi.
395
+ More information can be found at <a class="reference external" href="repositoryhttps://github.com/camptocamp/ebilling-postfinance">repositoryhttps://github.com/camptocamp/ebilling-postfinance</a>.</p>
396
+ </div>
397
+ <div class="section" id="configuration">
398
+ <h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
399
+ </div>
400
+ <div class="section" id="create-a-service">
401
+ <h1><a class="toc-backref" href="#toc-entry-3">Create a service</a></h1>
402
+ <p>First you need to be registred on ‘Postfinance eBill service &lt;<a class="reference external" href="https://www.postfinance.ch/en/business/products/accounts-receivable-solutions/e-bill-invoice-issuer.html">https://www.postfinance.ch/en/business/products/accounts-receivable-solutions/e-bill-invoice-issuer.html</a>&gt;’
403
+ To create a service go to <cite>Accounting - Configuration - Payments - Postfinance eBill Service</cite></p>
404
+ </div>
405
+ <div class="section" id="configure-a-customer-and-create-his-contract">
406
+ <h1><a class="toc-backref" href="#toc-entry-4">Configure a customer and create his contract</a></h1>
407
+ <p>The contracts specific to Postfinance e-billing are located in <cite>Accounting - Customers - eBill Postfinance Contract</cite>
408
+ Create a contract for a customer with his PayerId and make sure that the contract is active by being in <cite>Open</cite> state with valid start/end dates.</p>
409
+ <p>Set <cite>Customer Invoice Transmission Method</cite> on the customer to Postfinance.</p>
410
+ </div>
411
+ <div class="section" id="usage">
412
+ <h1><a class="toc-backref" href="#toc-entry-5">Usage</a></h1>
413
+ <p>To use this module, you need to:</p>
414
+ <ol class="arabic simple">
415
+ <li>Configure the service, customers and contracts as described in the CONFIGURATION section.</li>
416
+ <li>Create an invoice for a customer with an open Postfinance contract.</li>
417
+ <li>Validate the invoice, and click the Send eBill button.</li>
418
+ </ol>
419
+ </div>
420
+ <div class="section" id="known-issues-roadmap">
421
+ <h1><a class="toc-backref" href="#toc-entry-6">Known issues / Roadmap</a></h1>
422
+ <p>ToDo</p>
423
+ <ul class="simple">
424
+ <li>Add option to import the contract subscription (csv)</li>
425
+ <li>Add the download of this csv from web service, but what is the endpoint ?</li>
426
+ </ul>
427
+ <p>Nice to have</p>
428
+ <ul class="simple">
429
+ <li>Add a link to the failed job in the chatter message.</li>
430
+ <li>Add an action on partner to create a ebilling contract.</li>
431
+ </ul>
432
+ </div>
433
+ <div class="section" id="bug-tracker">
434
+ <h1><a class="toc-backref" href="#toc-entry-7">Bug Tracker</a></h1>
435
+ <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-switzerland/issues">GitHub Issues</a>.
436
+ In case of trouble, please check there if your issue has already been reported.
437
+ If you spotted it first, help us to smash it by providing a detailed and welcomed
438
+ <a class="reference external" href="https://github.com/OCA/l10n-switzerland/issues/new?body=module:%20ebill_postfinance%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
439
+ <p>Do not contact contributors directly about support or help with technical issues.</p>
440
+ </div>
441
+ <div class="section" id="credits">
442
+ <h1><a class="toc-backref" href="#toc-entry-8">Credits</a></h1>
443
+ <div class="section" id="authors">
444
+ <h2><a class="toc-backref" href="#toc-entry-9">Authors</a></h2>
445
+ <ul class="simple">
446
+ <li>Camptocamp</li>
447
+ </ul>
448
+ </div>
449
+ <div class="section" id="contributors">
450
+ <h2><a class="toc-backref" href="#toc-entry-10">Contributors</a></h2>
451
+ <ul class="simple">
452
+ <li>Thierry Ducrest &lt;<a class="reference external" href="mailto:thierry.ducrest&#64;camptocamp.com">thierry.ducrest&#64;camptocamp.com</a>&gt;</li>
453
+ </ul>
454
+ </div>
455
+ <div class="section" id="maintainers">
456
+ <h2><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h2>
457
+ <p>This module is maintained by the OCA.</p>
458
+ <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
459
+ <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
460
+ mission is to support the collaborative development of Odoo features and
461
+ promote its widespread use.</p>
462
+ <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
463
+ <p><a class="reference external image-reference" href="https://github.com/TDu"><img alt="TDu" src="https://github.com/TDu.png?size=40px" /></a></p>
464
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-switzerland/tree/16.0/ebill_postfinance">OCA/l10n-switzerland</a> project on GitHub.</p>
465
+ <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
466
+ </div>
467
+ </div>
468
+ </div>
469
+ </body>
470
+ </html>
@@ -0,0 +1,3 @@
1
+ from . import test_ebill_postfinance
2
+ from . import test_ebill_postfinance_message_yb
3
+ from . import test_ebill_postfinance_message_yb_creditnote
@@ -0,0 +1,194 @@
1
+ # Copyright 2022 Camptocamp SA
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
3
+
4
+ import logging
5
+ import os
6
+ from os.path import dirname, join
7
+
8
+ from vcr import VCR
9
+ from xmlunittest import XmlTestMixin
10
+
11
+ from odoo.tests.common import TransactionCase
12
+
13
+ _logger = logging.getLogger(__name__)
14
+
15
+
16
+ class CommonCase(TransactionCase, XmlTestMixin):
17
+ @classmethod
18
+ def setUpClass(cls):
19
+ super().setUpClass()
20
+ cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
21
+ cls.service = cls.env["ebill.postfinance.service"].create(
22
+ {
23
+ "name": "Postfinance Test Service",
24
+ "use_test_service": True,
25
+ "biller_id": os.getenv("BILLER_ID", "41101000001021209"),
26
+ "username": os.getenv("POSTFINANCE_USER", "user"),
27
+ "password": os.getenv("POSTFINANCE_PWD", "pwd"),
28
+ }
29
+ )
30
+ cls.country = cls.env.ref("base.ch")
31
+ cls.company = cls.env.ref("l10n_ch.demo_company_ch")
32
+ cls.env.user.company_id = cls.company
33
+ cls.company.vat = "CHE-012.345.678"
34
+ cls.company.name = "Camptocamp SA"
35
+ cls.company.street = "StreetOne"
36
+ cls.company.street2 = ""
37
+ cls.company.zip = "1015"
38
+ cls.company.city = "Lausanne"
39
+ cls.company.partner_id.country_id = cls.country
40
+ cls.company.email = "info@camptocamp.com"
41
+ cls.company.phone = ""
42
+ cls.bank = cls.env.ref("base.res_bank_1")
43
+ cls.bank.bic = 777
44
+ cls.tax7 = cls.env.ref("l10n_ch.{}_vat_77".format(cls.company.id))
45
+ cls.partner_bank = cls.env["res.partner.bank"].create(
46
+ {
47
+ "bank_id": cls.bank.id,
48
+ "acc_number": "CH04 8914 4618 6435 6132 2",
49
+ "acc_holder_name": "AccountHolderName",
50
+ "partner_id": cls.company.partner_id.id,
51
+ "l10n_ch_qr_iban": "CH2130808001234567827",
52
+ }
53
+ )
54
+ cls.terms = cls.env.ref("account.account_payment_term_15days")
55
+ cls.state = cls.env["res.country.state"].create(
56
+ {"code": "RR", "name": "Fribourg", "country_id": cls.country.id}
57
+ )
58
+ cls.customer = cls.env["res.partner"].create(
59
+ {
60
+ "name": "Test RAD Customer XML",
61
+ "customer_rank": 1,
62
+ "is_company": True,
63
+ "street": "Teststrasse 100",
64
+ "street2": "This is a very long street name that should be snapped",
65
+ "city": "Fribourg",
66
+ "zip": "1700",
67
+ "country_id": cls.country.id,
68
+ "state_id": cls.state.id,
69
+ }
70
+ )
71
+ cls.customer_delivery = cls.env["res.partner"].create(
72
+ {
73
+ "name": "The Shed in the yard",
74
+ "street": "Teststrasse 102",
75
+ "city": "Fribourg",
76
+ "zip": "1700",
77
+ "parent_id": cls.customer.id,
78
+ "type": "delivery",
79
+ }
80
+ )
81
+ cls.contract = cls.env["ebill.payment.contract"].create(
82
+ {
83
+ "partner_id": cls.customer.id,
84
+ "postfinance_billerid": "41010198248040391",
85
+ "state": "open",
86
+ "postfinance_service_id": cls.service.id,
87
+ }
88
+ )
89
+ cls.account = cls.env["account.account"].search(
90
+ [("account_type", "=", "asset_receivable")],
91
+ limit=1,
92
+ )
93
+ cls.product = cls.env["product.product"].create(
94
+ {"name": "Product Q & A", "list_price": 100.00, "default_code": "370003021"}
95
+ )
96
+ cls.product_long_name = cls.env["product.product"].create(
97
+ {
98
+ "name": "Product With a Very Long Name That Need To Be Truncated",
99
+ "list_price": 0.00,
100
+ "default_code": "370003022",
101
+ }
102
+ )
103
+ cls.product.product_tmpl_id.invoice_policy = "order"
104
+ cls.product_long_name.product_tmpl_id.invoice_policy = "order"
105
+ cls.sale = cls.env["sale.order"].create(
106
+ {
107
+ "name": "Order123",
108
+ "partner_id": cls.customer.id,
109
+ "partner_shipping_id": cls.customer_delivery.id,
110
+ "client_order_ref": "CustomerRef",
111
+ "order_line": [
112
+ (
113
+ 0,
114
+ 0,
115
+ {
116
+ "product_id": cls.product.id,
117
+ "name": cls.product.name,
118
+ "product_uom_qty": 4.0,
119
+ "price_unit": 123.0,
120
+ "tax_id": [(4, cls.tax7.id, 0)],
121
+ },
122
+ ),
123
+ (
124
+ 0,
125
+ 0,
126
+ {
127
+ "product_id": cls.product_long_name.id,
128
+ "name": cls.product_long_name.name,
129
+ "product_uom_qty": 1.0,
130
+ "price_unit": 0.0,
131
+ "tax_id": [(4, cls.tax7.id, 0)],
132
+ },
133
+ ),
134
+ ],
135
+ }
136
+ )
137
+ cls.sale.action_confirm()
138
+ cls.sale.date_order = "2019-06-01"
139
+ # Generate the invoice from the sale order
140
+ cls.invoice = cls.sale._create_invoices()
141
+ # And add some more lines on the invoice
142
+ # One UX line and one not linked to a product and without VAT
143
+ cls.invoice.update(
144
+ {
145
+ "line_ids": [
146
+ (0, 0, {"name": "A little note", "display_type": "line_note"}),
147
+ (
148
+ 0,
149
+ 0,
150
+ {
151
+ "name": "Phone support",
152
+ "quantity": 4.0,
153
+ "price_unit": 0,
154
+ # Force not tax on this line, for testing purpose
155
+ "tax_ids": [(5, 0, 0)],
156
+ },
157
+ ),
158
+ ],
159
+ }
160
+ )
161
+ cls.invoice.payment_reference = "210000000003139471430009017"
162
+ cls.invoice.partner_bank_id = cls.partner_bank.id
163
+
164
+ @staticmethod
165
+ def compare_xml_line_by_line(content, expected):
166
+ """This a quick way to check the diff line by line to ease debugging"""
167
+ generated_line = [i.strip() for i in content.split(b"\n") if len(i.strip())]
168
+ expected_line = [i.strip() for i in expected.split(b"\n") if len(i.strip())]
169
+ number_of_lines = len(expected_line)
170
+ for i in range(number_of_lines):
171
+ if generated_line[i].strip() != expected_line[i].strip():
172
+ return "Diff at {}/{} || Expected {} || Generated {}".format(
173
+ i,
174
+ number_of_lines,
175
+ expected_line[i],
176
+ generated_line[i],
177
+ )
178
+
179
+
180
+ def get_recorder(base_path=None, **kw):
181
+ base_path = base_path or dirname(__file__)
182
+ defaults = dict(
183
+ record_mode="once",
184
+ cassette_library_dir=join(base_path, "fixtures/cassettes"),
185
+ path_transformer=VCR.ensure_suffix(".yaml"),
186
+ match_on=["method", "path", "query"],
187
+ filter_headers=["Authorization"],
188
+ decode_compressed_response=True,
189
+ )
190
+ defaults.update(kw)
191
+ return VCR(**defaults)
192
+
193
+
194
+ recorder = get_recorder()