odoo-addon-ebill-postfinance 16.0.1.0.0.6__py3-none-any.whl → 18.0.1.0.0.7__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.
- odoo/addons/ebill_postfinance/README.rst +42 -29
- odoo/addons/ebill_postfinance/__manifest__.py +1 -1
- odoo/addons/ebill_postfinance/data/ir_cron.xml +0 -2
- odoo/addons/ebill_postfinance/data/mail_activity_type.xml +7 -7
- odoo/addons/ebill_postfinance/data/transmit.method.xml +1 -1
- odoo/addons/ebill_postfinance/i18n/ebill_postfinance.pot +3 -16
- odoo/addons/ebill_postfinance/messages/invoice-2003A.jinja +1 -1
- odoo/addons/ebill_postfinance/messages/invoice-yellowbill.jinja +2 -2
- odoo/addons/ebill_postfinance/models/__init__.py +1 -0
- odoo/addons/ebill_postfinance/models/account_move.py +14 -8
- odoo/addons/ebill_postfinance/models/account_move_line.py +36 -0
- odoo/addons/ebill_postfinance/models/ebill_payment_contract.py +6 -3
- odoo/addons/ebill_postfinance/models/ebill_postfinance_invoice_message.py +16 -18
- odoo/addons/ebill_postfinance/models/ebill_postfinance_service.py +1 -1
- odoo/addons/ebill_postfinance/models/sale_order.py +0 -1
- odoo/addons/ebill_postfinance/readme/CONFIGURE.md +15 -0
- odoo/addons/ebill_postfinance/readme/CONTRIBUTORS.md +2 -0
- odoo/addons/ebill_postfinance/readme/{DESCRIPTION.rst → DESCRIPTION.md} +2 -1
- odoo/addons/ebill_postfinance/readme/INSTALL.md +3 -0
- odoo/addons/ebill_postfinance/readme/ROADMAP.md +10 -0
- odoo/addons/ebill_postfinance/readme/USAGE.md +6 -0
- odoo/addons/ebill_postfinance/static/description/index.html +55 -35
- odoo/addons/ebill_postfinance/tests/__init__.py +1 -0
- odoo/addons/ebill_postfinance/tests/common.py +33 -8
- odoo/addons/ebill_postfinance/tests/{examples → samples}/credit_note_yb.xml +24 -19
- odoo/addons/ebill_postfinance/tests/{examples → samples}/invoice_qr_yb.xml +27 -21
- odoo/addons/ebill_postfinance/tests/{examples → samples}/yellowbill_qr_iban.xml +164 -163
- odoo/addons/ebill_postfinance/tests/test_account_move.py +57 -0
- odoo/addons/ebill_postfinance/tests/test_ebill_postfinance.py +8 -2
- odoo/addons/ebill_postfinance/tests/test_ebill_postfinance_message_yb.py +7 -11
- odoo/addons/ebill_postfinance/tests/test_ebill_postfinance_message_yb_creditnote.py +5 -9
- odoo/addons/ebill_postfinance/views/ebill_payment_contract.xml +14 -17
- odoo/addons/ebill_postfinance/views/ebill_postfinance_invoice_message.xml +21 -21
- odoo/addons/ebill_postfinance/views/ebill_postfinance_service.xml +15 -15
- {odoo_addon_ebill_postfinance-16.0.1.0.0.6.dist-info → odoo_addon_ebill_postfinance-18.0.1.0.0.7.dist-info}/METADATA +52 -38
- odoo_addon_ebill_postfinance-18.0.1.0.0.7.dist-info/RECORD +46 -0
- {odoo_addon_ebill_postfinance-16.0.1.0.0.6.dist-info → odoo_addon_ebill_postfinance-18.0.1.0.0.7.dist-info}/WHEEL +1 -1
- odoo_addon_ebill_postfinance-18.0.1.0.0.7.dist-info/top_level.txt +1 -0
- odoo/addons/ebill_postfinance/readme/CONFIGURE.rst +0 -13
- odoo/addons/ebill_postfinance/readme/CONTRIBUTORS.rst +0 -1
- odoo/addons/ebill_postfinance/readme/INSTALL.rst +0 -2
- odoo/addons/ebill_postfinance/readme/ROADMAP.rst +0 -10
- odoo/addons/ebill_postfinance/readme/USAGE.rst +0 -5
- odoo_addon_ebill_postfinance-16.0.1.0.0.6.dist-info/RECORD +0 -44
- odoo_addon_ebill_postfinance-16.0.1.0.0.6.dist-info/top_level.txt +0 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
.. image:: https://odoo-community.org/readme-banner-image
|
|
2
|
+
:target: https://odoo-community.org/get-involved?utm_source=readme
|
|
3
|
+
:alt: Odoo Community Association
|
|
4
|
+
|
|
1
5
|
=================
|
|
2
6
|
eBill Postfinance
|
|
3
7
|
=================
|
|
@@ -7,28 +11,29 @@ eBill Postfinance
|
|
|
7
11
|
!! This file is generated by oca-gen-addon-readme !!
|
|
8
12
|
!! changes will be overwritten. !!
|
|
9
13
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
10
|
-
!! source digest: sha256:
|
|
14
|
+
!! source digest: sha256:70553006c73d13f974e48d52641436b9d6be23fb09a43c219b113be254f6e9d1
|
|
11
15
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
12
16
|
|
|
13
17
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
|
14
18
|
:target: https://odoo-community.org/page/development-status
|
|
15
19
|
:alt: Beta
|
|
16
|
-
.. |badge2| image:: https://img.shields.io/badge/
|
|
20
|
+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
|
|
17
21
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
|
18
22
|
:alt: License: AGPL-3
|
|
19
23
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--switzerland-lightgray.png?logo=github
|
|
20
|
-
:target: https://github.com/OCA/l10n-switzerland/tree/
|
|
24
|
+
:target: https://github.com/OCA/l10n-switzerland/tree/18.0/ebill_postfinance
|
|
21
25
|
:alt: OCA/l10n-switzerland
|
|
22
26
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
|
23
|
-
:target: https://translation.odoo-community.org/projects/l10n-switzerland-
|
|
27
|
+
:target: https://translation.odoo-community.org/projects/l10n-switzerland-18-0/l10n-switzerland-18-0-ebill_postfinance
|
|
24
28
|
:alt: Translate me on Weblate
|
|
25
29
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
|
26
|
-
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-switzerland&target_branch=
|
|
30
|
+
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-switzerland&target_branch=18.0
|
|
27
31
|
:alt: Try me on Runboat
|
|
28
32
|
|
|
29
33
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|
30
34
|
|
|
31
|
-
This module implements the exchange of electronic invoices with the
|
|
35
|
+
This module implements the exchange of electronic invoices with the
|
|
36
|
+
Postfinance web service.
|
|
32
37
|
|
|
33
38
|
**Table of contents**
|
|
34
39
|
|
|
@@ -38,48 +43,55 @@ This module implements the exchange of electronic invoices with the Postfinance
|
|
|
38
43
|
Installation
|
|
39
44
|
============
|
|
40
45
|
|
|
41
|
-
This module needs the Python library
|
|
42
|
-
More information can be found at
|
|
46
|
+
This module needs the Python library ebilling_postfinance which can be
|
|
47
|
+
installed from Pypi. More information can be found at
|
|
48
|
+
`repository <repository%20https://github.com/camptocamp/ebilling-postfinance>`__
|
|
49
|
+
https://github.com/camptocamp/ebilling-postfinance.
|
|
43
50
|
|
|
44
51
|
Configuration
|
|
45
52
|
=============
|
|
46
53
|
|
|
47
54
|
Create a service
|
|
48
|
-
|
|
55
|
+
----------------
|
|
49
56
|
|
|
50
|
-
First you need to be registred on 'Postfinance eBill service
|
|
51
|
-
|
|
57
|
+
First you need to be registred on 'Postfinance eBill service
|
|
58
|
+
<https://www.postfinance.ch/en/business/products/accounts-receivable-solutions/e-bill-invoice-issuer.html>'
|
|
59
|
+
To create a service go to Accounting - Configuration - Payments -
|
|
60
|
+
Postfinance eBill Service
|
|
52
61
|
|
|
53
62
|
Configure a customer and create his contract
|
|
54
|
-
|
|
63
|
+
--------------------------------------------
|
|
55
64
|
|
|
56
|
-
The contracts specific to Postfinance e-billing are located in
|
|
57
|
-
|
|
65
|
+
The contracts specific to Postfinance e-billing are located in
|
|
66
|
+
Accounting - Customers - eBill Postfinance Contract Create a contract
|
|
67
|
+
for a customer with his PayerId and make sure that the contract is
|
|
68
|
+
active by being in Open state with valid start/end dates.
|
|
58
69
|
|
|
59
|
-
Set
|
|
70
|
+
Set Customer Invoice Transmission Method on the customer to Postfinance.
|
|
60
71
|
|
|
61
72
|
Usage
|
|
62
73
|
=====
|
|
63
74
|
|
|
64
75
|
To use this module, you need to:
|
|
65
76
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
1. Configure the service, customers and contracts as described in the
|
|
78
|
+
CONFIGURATION section.
|
|
79
|
+
2. Create an invoice for a customer with an open Postfinance contract.
|
|
80
|
+
3. Validate the invoice, and click the Send eBill button.
|
|
69
81
|
|
|
70
82
|
Known issues / Roadmap
|
|
71
83
|
======================
|
|
72
84
|
|
|
73
85
|
ToDo
|
|
74
86
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
87
|
+
- Add option to import the contract subscription (csv)
|
|
88
|
+
- Add the download of this csv from web service, but what is the
|
|
89
|
+
endpoint ?
|
|
78
90
|
|
|
79
91
|
Nice to have
|
|
80
92
|
|
|
81
|
-
|
|
82
|
-
|
|
93
|
+
- Add a link to the failed job in the chatter message.
|
|
94
|
+
- Add an action on partner to create a ebilling contract.
|
|
83
95
|
|
|
84
96
|
Bug Tracker
|
|
85
97
|
===========
|
|
@@ -87,7 +99,7 @@ Bug Tracker
|
|
|
87
99
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-switzerland/issues>`_.
|
|
88
100
|
In case of trouble, please check there if your issue has already been reported.
|
|
89
101
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
|
90
|
-
`feedback <https://github.com/OCA/l10n-switzerland/issues/new?body=module:%20ebill_postfinance%0Aversion:%
|
|
102
|
+
`feedback <https://github.com/OCA/l10n-switzerland/issues/new?body=module:%20ebill_postfinance%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
|
91
103
|
|
|
92
104
|
Do not contact contributors directly about support or help with technical issues.
|
|
93
105
|
|
|
@@ -95,17 +107,18 @@ Credits
|
|
|
95
107
|
=======
|
|
96
108
|
|
|
97
109
|
Authors
|
|
98
|
-
|
|
110
|
+
-------
|
|
99
111
|
|
|
100
112
|
* Camptocamp
|
|
101
113
|
|
|
102
114
|
Contributors
|
|
103
|
-
|
|
115
|
+
------------
|
|
104
116
|
|
|
105
|
-
|
|
117
|
+
- Thierry Ducrest <thierry.ducrest@camptocamp.com>
|
|
118
|
+
- Simone Orsi <simone.orsi@camptocamp.com>
|
|
106
119
|
|
|
107
120
|
Maintainers
|
|
108
|
-
|
|
121
|
+
-----------
|
|
109
122
|
|
|
110
123
|
This module is maintained by the OCA.
|
|
111
124
|
|
|
@@ -125,6 +138,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
|
|
125
138
|
|
|
126
139
|
|maintainer-TDu|
|
|
127
140
|
|
|
128
|
-
This module is part of the `OCA/l10n-switzerland <https://github.com/OCA/l10n-switzerland/tree/
|
|
141
|
+
This module is part of the `OCA/l10n-switzerland <https://github.com/OCA/l10n-switzerland/tree/18.0/ebill_postfinance>`_ project on GitHub.
|
|
129
142
|
|
|
130
143
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
<field name="name">eBill Postfinance - Check invoices state on server</field>
|
|
5
5
|
<field name="interval_number">1</field>
|
|
6
6
|
<field name="interval_type">hours</field>
|
|
7
|
-
<field name="numbercall">-1</field>
|
|
8
7
|
<field name="active" eval="True" />
|
|
9
|
-
<field name="doall" eval="False" />
|
|
10
8
|
<field name="model_id" ref="model_ebill_postfinance_service" />
|
|
11
9
|
<field name="state">code</field>
|
|
12
10
|
<field name="code">model.cron_update_invoices()</field>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
2
|
<odoo noupdate="1">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
<record id="mail_activity_ebill_postfinance_error" model="mail.activity.type">
|
|
4
|
+
<field name="name">eBill Postfinance Error</field>
|
|
5
|
+
<field name="icon">fa-warning</field>
|
|
6
|
+
<field name="delay_count">0</field>
|
|
7
|
+
<field name="sequence">99</field>
|
|
8
|
+
<field name="decoration_type">warning</field>
|
|
9
|
+
</record>
|
|
10
10
|
</odoo>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
2
|
<odoo>
|
|
3
|
-
<record id="postfinance_transmit_method" model="transmit.method">
|
|
3
|
+
<record id="postfinance_transmit_method" model="transmit.method" forcecreate="True">
|
|
4
4
|
<field name="name">Postfinance</field>
|
|
5
5
|
<field name="code">postfinance</field>
|
|
6
6
|
<field name="customer_ok" eval="True" />
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
#
|
|
5
5
|
msgid ""
|
|
6
6
|
msgstr ""
|
|
7
|
-
"Project-Id-Version: Odoo Server
|
|
7
|
+
"Project-Id-Version: Odoo Server 18.0\n"
|
|
8
8
|
"Report-Msgid-Bugs-To: \n"
|
|
9
9
|
"Last-Translator: \n"
|
|
10
10
|
"Language-Team: \n"
|
|
@@ -16,7 +16,6 @@ msgstr ""
|
|
|
16
16
|
#. module: ebill_postfinance
|
|
17
17
|
#. odoo-python
|
|
18
18
|
#: code:addons/ebill_postfinance/models/ebill_payment_contract.py:0
|
|
19
|
-
#, python-format
|
|
20
19
|
msgid "A Postfinance service is required for a Postfinance contract."
|
|
21
20
|
msgstr ""
|
|
22
21
|
|
|
@@ -132,7 +131,6 @@ msgstr ""
|
|
|
132
131
|
#. module: ebill_postfinance
|
|
133
132
|
#. odoo-python
|
|
134
133
|
#: code:addons/ebill_postfinance/models/account_move.py:0
|
|
135
|
-
#, python-format
|
|
136
134
|
msgid "Error generating postfinance eBill"
|
|
137
135
|
msgstr ""
|
|
138
136
|
|
|
@@ -167,11 +165,6 @@ msgstr ""
|
|
|
167
165
|
msgid "ID"
|
|
168
166
|
msgstr ""
|
|
169
167
|
|
|
170
|
-
#. module: ebill_postfinance
|
|
171
|
-
#: model:ir.model.fields.selection,name:ebill_postfinance.selection__ebill_payment_contract__payment_type__isr
|
|
172
|
-
msgid "ISR"
|
|
173
|
-
msgstr ""
|
|
174
|
-
|
|
175
168
|
#. module: ebill_postfinance
|
|
176
169
|
#: model_terms:ir.ui.view,arch_db:ebill_postfinance.ebill_postfinance_invoice_message_search_view
|
|
177
170
|
msgid "In Error"
|
|
@@ -206,14 +199,12 @@ msgstr ""
|
|
|
206
199
|
#. module: ebill_postfinance
|
|
207
200
|
#. odoo-python
|
|
208
201
|
#: code:addons/ebill_postfinance/models/account_move.py:0
|
|
209
|
-
#, python-format
|
|
210
202
|
msgid "Invoice accepted by the Postfinance system"
|
|
211
203
|
msgstr ""
|
|
212
204
|
|
|
213
205
|
#. module: ebill_postfinance
|
|
214
206
|
#. odoo-python
|
|
215
207
|
#: code:addons/ebill_postfinance/models/ebill_postfinance_invoice_message.py:0
|
|
216
|
-
#, python-format
|
|
217
208
|
msgid "Invoice paid through eBilling"
|
|
218
209
|
msgstr ""
|
|
219
210
|
|
|
@@ -245,9 +236,8 @@ msgid "Journal Entry"
|
|
|
245
236
|
msgstr ""
|
|
246
237
|
|
|
247
238
|
#. module: ebill_postfinance
|
|
248
|
-
#: model:ir.model
|
|
249
|
-
|
|
250
|
-
msgid "Last Modified on"
|
|
239
|
+
#: model:ir.model,name:ebill_postfinance.model_account_move_line
|
|
240
|
+
msgid "Journal Item"
|
|
251
241
|
msgstr ""
|
|
252
242
|
|
|
253
243
|
#. module: ebill_postfinance
|
|
@@ -470,7 +460,6 @@ msgstr ""
|
|
|
470
460
|
#. module: ebill_postfinance
|
|
471
461
|
#. odoo-python
|
|
472
462
|
#: code:addons/ebill_postfinance/models/ebill_payment_contract.py:0
|
|
473
|
-
#, python-format
|
|
474
463
|
msgid "The Postfinacnce Account ID is required for a Postfinance contract."
|
|
475
464
|
msgstr ""
|
|
476
465
|
|
|
@@ -482,7 +471,6 @@ msgstr ""
|
|
|
482
471
|
#. module: ebill_postfinance
|
|
483
472
|
#. odoo-python
|
|
484
473
|
#: code:addons/ebill_postfinance/models/ebill_postfinance_invoice_message.py:0
|
|
485
|
-
#, python-format
|
|
486
474
|
msgid "The payload is valid."
|
|
487
475
|
msgstr ""
|
|
488
476
|
|
|
@@ -523,7 +511,6 @@ msgstr ""
|
|
|
523
511
|
|
|
524
512
|
#. module: ebill_postfinance
|
|
525
513
|
#: model:ir.actions.server,name:ebill_postfinance.cron_search_invoices_ir_actions_server
|
|
526
|
-
#: model:ir.cron,cron_name:ebill_postfinance.cron_search_invoices
|
|
527
514
|
msgid "eBill Postfinance - Check invoices state on server"
|
|
528
515
|
msgstr ""
|
|
529
516
|
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
{%- if loop.index == 1 %}
|
|
180
180
|
<TAX>
|
|
181
181
|
<Rate>{{ tax.amount}}</Rate>
|
|
182
|
-
<Amount Currency="{{ invoice.currency_id.name }}">{{
|
|
182
|
+
<Amount Currency="{{ invoice.currency_id.name }}">{{ line._ebill_tax_amount(tax)|round(2) }}</Amount>
|
|
183
183
|
</TAX>
|
|
184
184
|
{%- endif %}
|
|
185
185
|
{% else %}
|
|
@@ -163,11 +163,11 @@
|
|
|
163
163
|
<Tax>
|
|
164
164
|
<TaxDetail>
|
|
165
165
|
<Rate>{{ tax.amount|round(2)|replace(",", ".") }}</Rate>
|
|
166
|
-
<Amount>{{
|
|
166
|
+
<Amount>{{ line._ebill_tax_amount(tax)|round(2) }}</Amount>
|
|
167
167
|
<BaseAmountExclusiveTax>{{ line.price_subtotal|round(6) }}</BaseAmountExclusiveTax>
|
|
168
168
|
<BaseAmountInclusiveTax>{{ line.price_total|round(6) }}</BaseAmountInclusiveTax>
|
|
169
169
|
</TaxDetail>
|
|
170
|
-
<TotalTax>{{
|
|
170
|
+
<TotalTax>{{ line._ebill_tax_amount(tax)|round(2) }}</TotalTax>
|
|
171
171
|
</Tax>
|
|
172
172
|
{%- endif %}
|
|
173
173
|
{% endfor %}
|
|
@@ -5,7 +5,7 @@ import base64
|
|
|
5
5
|
import logging
|
|
6
6
|
|
|
7
7
|
import odoo
|
|
8
|
-
from odoo import
|
|
8
|
+
from odoo import api, fields, models
|
|
9
9
|
from odoo.exceptions import UserError
|
|
10
10
|
from odoo.tools.pdf import merge_pdf
|
|
11
11
|
|
|
@@ -13,11 +13,17 @@ _logger = logging.getLogger(__name__)
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class AccountMove(models.Model):
|
|
16
|
-
|
|
17
16
|
_inherit = "account.move"
|
|
18
17
|
|
|
19
|
-
@api.
|
|
20
|
-
def
|
|
18
|
+
@api.depends("transmit_method_id")
|
|
19
|
+
def _compute_partner_bank_id(self): # pylint: disable=missing-return
|
|
20
|
+
super()._compute_partner_bank_id()
|
|
21
|
+
for rec in self:
|
|
22
|
+
pf_partner_bank = rec._get_postfinance_partner_bank()
|
|
23
|
+
if pf_partner_bank:
|
|
24
|
+
rec.partner_bank_id = pf_partner_bank
|
|
25
|
+
|
|
26
|
+
def _get_postfinance_partner_bank(self):
|
|
21
27
|
if self.move_type not in ("out_invoice", "out_refund"):
|
|
22
28
|
return
|
|
23
29
|
postfinance_method = self.env.ref(
|
|
@@ -26,7 +32,7 @@ class AccountMove(models.Model):
|
|
|
26
32
|
if self.transmit_method_id == postfinance_method:
|
|
27
33
|
contract = self.partner_id.get_active_contract(self.transmit_method_id)
|
|
28
34
|
if contract:
|
|
29
|
-
|
|
35
|
+
return contract.postfinance_service_id.partner_bank_id
|
|
30
36
|
|
|
31
37
|
def _export_invoice(self):
|
|
32
38
|
"""Export invoice with the help of account_invoice_export module."""
|
|
@@ -37,10 +43,10 @@ class AccountMove(models.Model):
|
|
|
37
43
|
return super()._export_invoice()
|
|
38
44
|
message = self.create_postfinance_ebill()
|
|
39
45
|
if not message:
|
|
40
|
-
raise UserError(_("Error generating postfinance eBill"))
|
|
46
|
+
raise UserError(self.env._("Error generating postfinance eBill"))
|
|
41
47
|
message.send_to_postfinance()
|
|
42
48
|
self.invoice_exported = True
|
|
43
|
-
return "Postfinance invoice generated and in state {
|
|
49
|
+
return f"Postfinance invoice generated and in state {message.state}"
|
|
44
50
|
|
|
45
51
|
def create_postfinance_ebill(self):
|
|
46
52
|
"""Generate the message record for an invoice."""
|
|
@@ -121,7 +127,7 @@ class AccountMove(models.Model):
|
|
|
121
127
|
["ebill_postfinance.mail_activity_dws_error"],
|
|
122
128
|
feedback="It worked on a later try",
|
|
123
129
|
)
|
|
124
|
-
self.message_post(body=_("Invoice accepted by the Postfinance system"))
|
|
130
|
+
self.message_post(body=self.env._("Invoice accepted by the Postfinance system"))
|
|
125
131
|
self.invoice_export_confirmed = True
|
|
126
132
|
|
|
127
133
|
def log_invoice_refused_by_system(self):
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright 2025 Camptocamp SA
|
|
2
|
+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
3
|
+
|
|
4
|
+
from odoo import models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AccountMoveLine(models.Model):
|
|
8
|
+
_inherit = "account.move.line"
|
|
9
|
+
|
|
10
|
+
def _ebill_tax_amount(self, tax):
|
|
11
|
+
"""Helper to compute tax amount for a given tax on invoice line.
|
|
12
|
+
|
|
13
|
+
:param tax: The tax to compute.
|
|
14
|
+
:return: Computed tax amount.
|
|
15
|
+
"""
|
|
16
|
+
if not tax:
|
|
17
|
+
return 0.0
|
|
18
|
+
|
|
19
|
+
# Compute the tax amount
|
|
20
|
+
price_unit = self.price_unit
|
|
21
|
+
quantity = self.quantity
|
|
22
|
+
currency = self.move_id.currency_id
|
|
23
|
+
|
|
24
|
+
# Adjust price for discount
|
|
25
|
+
discount = self.discount or 0.0
|
|
26
|
+
price = price_unit * (1 - discount / 100)
|
|
27
|
+
|
|
28
|
+
# Compute the tax amount using the tax's compute_all method
|
|
29
|
+
res = tax.compute_all(
|
|
30
|
+
price_unit=price,
|
|
31
|
+
currency=currency,
|
|
32
|
+
quantity=quantity,
|
|
33
|
+
product=self.product_id,
|
|
34
|
+
partner=self.move_id.partner_id,
|
|
35
|
+
)
|
|
36
|
+
return res["taxes"][0]["amount"]
|
|
@@ -23,7 +23,7 @@ class EbillPaymentContract(models.Model):
|
|
|
23
23
|
compute="_compute_is_postfinance_method_on_partner"
|
|
24
24
|
)
|
|
25
25
|
payment_type = fields.Selection(
|
|
26
|
-
selection=[("qr", "QR")
|
|
26
|
+
selection=[("qr", "QR")],
|
|
27
27
|
string="Payment method",
|
|
28
28
|
default="qr",
|
|
29
29
|
help="Payment type to use for the invoices sent,"
|
|
@@ -60,7 +60,8 @@ class EbillPaymentContract(models.Model):
|
|
|
60
60
|
if not contract.postfinance_billerid:
|
|
61
61
|
raise ValidationError(
|
|
62
62
|
_(
|
|
63
|
-
"The Postfinacnce Account ID is required for a
|
|
63
|
+
"The Postfinacnce Account ID is required for a "
|
|
64
|
+
"Postfinance contract."
|
|
64
65
|
)
|
|
65
66
|
)
|
|
66
67
|
|
|
@@ -69,5 +70,7 @@ class EbillPaymentContract(models.Model):
|
|
|
69
70
|
for contract in self:
|
|
70
71
|
if contract.is_postfinance_contract and not contract.postfinance_service_id:
|
|
71
72
|
raise ValidationError(
|
|
72
|
-
_(
|
|
73
|
+
self.env._(
|
|
74
|
+
"A Postfinance service is required for a Postfinance contract."
|
|
75
|
+
)
|
|
73
76
|
)
|
|
@@ -9,7 +9,7 @@ import pytz
|
|
|
9
9
|
from jinja2 import Environment, FileSystemLoader
|
|
10
10
|
from lxml import etree
|
|
11
11
|
|
|
12
|
-
from odoo import
|
|
12
|
+
from odoo import api, fields, models
|
|
13
13
|
from odoo.exceptions import UserError
|
|
14
14
|
from odoo.modules.module import get_module_root
|
|
15
15
|
|
|
@@ -139,7 +139,9 @@ class EbillPostfinanceInvoiceMessage(models.Model):
|
|
|
139
139
|
for record in self:
|
|
140
140
|
if record.state != "done":
|
|
141
141
|
record.state = "done"
|
|
142
|
-
record.invoice_id.message_post(
|
|
142
|
+
record.invoice_id.message_post(
|
|
143
|
+
body=self.env._("Invoice paid through eBilling")
|
|
144
|
+
)
|
|
143
145
|
|
|
144
146
|
@api.model
|
|
145
147
|
def _remove_pdf_data_from_payload(self, data):
|
|
@@ -200,6 +202,7 @@ class EbillPostfinanceInvoiceMessage(models.Model):
|
|
|
200
202
|
return date_string.strftime("%Y-%m-%d")
|
|
201
203
|
|
|
202
204
|
def _get_payload_params(self):
|
|
205
|
+
bank_account = ""
|
|
203
206
|
bank_account = sanitize_account_number(
|
|
204
207
|
self.invoice_id.partner_bank_id.l10n_ch_qr_iban
|
|
205
208
|
or self.invoice_id.partner_bank_id.acc_number
|
|
@@ -244,16 +247,11 @@ class EbillPostfinanceInvoiceMessage(models.Model):
|
|
|
244
247
|
return params
|
|
245
248
|
|
|
246
249
|
def _get_payload_params_yb(self):
|
|
247
|
-
bank_account =
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
)
|
|
253
|
-
else:
|
|
254
|
-
bank_account = sanitize_account_number(
|
|
255
|
-
self.invoice_id.partner_bank_id.acc_number or ""
|
|
256
|
-
)
|
|
250
|
+
bank_account = sanitize_account_number(
|
|
251
|
+
self.invoice_id.partner_bank_id.l10n_ch_qr_iban
|
|
252
|
+
or self.invoice_id.partner_bank_id.acc_number
|
|
253
|
+
or ""
|
|
254
|
+
)
|
|
257
255
|
delivery = (
|
|
258
256
|
self.invoice_id.partner_shipping_id
|
|
259
257
|
if self.invoice_id.partner_shipping_id != self.invoice_id.partner_id
|
|
@@ -285,14 +283,14 @@ class EbillPostfinanceInvoiceMessage(models.Model):
|
|
|
285
283
|
amount_by_group = []
|
|
286
284
|
# Get the percentage of the tax from the name of the group
|
|
287
285
|
# Could be improve by searching in the account_tax linked to the group
|
|
288
|
-
for
|
|
289
|
-
for taxgroup in
|
|
290
|
-
rate = taxgroup["
|
|
286
|
+
for subtotal in self.invoice_id.tax_totals["subtotals"]:
|
|
287
|
+
for taxgroup in subtotal["tax_groups"]:
|
|
288
|
+
rate = taxgroup["group_name"].split()[-1:][0][:-1]
|
|
291
289
|
amount_by_group.append(
|
|
292
290
|
(
|
|
293
291
|
rate or "0",
|
|
294
|
-
taxgroup["
|
|
295
|
-
taxgroup["
|
|
292
|
+
taxgroup["tax_amount"],
|
|
293
|
+
taxgroup["base_amount"],
|
|
296
294
|
)
|
|
297
295
|
)
|
|
298
296
|
params["amount_by_group"] = amount_by_group
|
|
@@ -354,7 +352,7 @@ class EbillPostfinanceInvoiceMessage(models.Model):
|
|
|
354
352
|
"type": "ir.actions.client",
|
|
355
353
|
"tag": "display_notification",
|
|
356
354
|
"params": {
|
|
357
|
-
"title": _("The payload is valid."),
|
|
355
|
+
"title": self.env._("The payload is valid."),
|
|
358
356
|
"sticky": False,
|
|
359
357
|
},
|
|
360
358
|
}
|
|
@@ -73,7 +73,7 @@ class EbillPostfinanceService(models.Model):
|
|
|
73
73
|
msg = ["Test connection to service"]
|
|
74
74
|
res = self.ping_service()
|
|
75
75
|
if res:
|
|
76
|
-
msg.append("Success pinging service \n Receive :{}"
|
|
76
|
+
msg.append(f"Success pinging service \n Receive :{res}")
|
|
77
77
|
else:
|
|
78
78
|
msg.append(" - Failed pinging service")
|
|
79
79
|
raise UserError("\n".join(msg))
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
## Create a service
|
|
2
|
+
|
|
3
|
+
First you need to be registred on 'Postfinance eBill service
|
|
4
|
+
\<<https://www.postfinance.ch/en/business/products/accounts-receivable-solutions/e-bill-invoice-issuer.html>\>'
|
|
5
|
+
To create a service go to Accounting - Configuration - Payments -
|
|
6
|
+
Postfinance eBill Service
|
|
7
|
+
|
|
8
|
+
## Configure a customer and create his contract
|
|
9
|
+
|
|
10
|
+
The contracts specific to Postfinance e-billing are located in
|
|
11
|
+
Accounting - Customers - eBill Postfinance Contract Create a contract
|
|
12
|
+
for a customer with his PayerId and make sure that the contract is
|
|
13
|
+
active by being in Open state with valid start/end dates.
|
|
14
|
+
|
|
15
|
+
Set Customer Invoice Transmission Method on the customer to Postfinance.
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
This module implements the exchange of electronic invoices with the
|
|
1
|
+
This module implements the exchange of electronic invoices with the
|
|
2
|
+
Postfinance web service.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
ToDo
|
|
2
|
+
|
|
3
|
+
- Add option to import the contract subscription (csv)
|
|
4
|
+
- Add the download of this csv from web service, but what is the
|
|
5
|
+
endpoint ?
|
|
6
|
+
|
|
7
|
+
Nice to have
|
|
8
|
+
|
|
9
|
+
- Add a link to the failed job in the chatter message.
|
|
10
|
+
- Add an action on partner to create a ebilling contract.
|