Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
3
3adentaire_account
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Le Filament
3A Dentaire
3adentaire_account
Commits
7ddd84eb
Commit
7ddd84eb
authored
3 years ago
by
Benjamin - Le Filament
Browse files
Options
Downloads
Patches
Plain Diff
[debug] add debug Ebics Download
parent
b76912d9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
__manifest__.py
+1
-1
1 addition, 1 deletion
__manifest__.py
models/ebics_xfer.py
+133
-0
133 additions, 0 deletions
models/ebics_xfer.py
with
134 additions
and
1 deletion
__manifest__.py
+
1
−
1
View file @
7ddd84eb
...
...
@@ -7,7 +7,7 @@
"
application
"
:
False
,
"
installable
"
:
True
,
"
depends
"
:
[
"
account
"
,
"
sale
"
"
account
"
,
"
sale
"
,
"
account_ebics
"
],
"
data
"
:
[
"
views/account_bank_statement.xml
"
,
...
...
This diff is collapsed.
Click to expand it.
models/ebics_xfer.py
0 → 100644
+
133
−
0
View file @
7ddd84eb
# Copyright 2020 Le Filament
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import
base64
import
logging
import
os
from
sys
import
exc_info
from
traceback
import
format_exception
from
odoo
import
api
,
fields
,
models
,
_
from
odoo.exceptions
import
UserError
_logger
=
logging
.
getLogger
(
__name__
)
try
:
import
fintech
from
fintech.ebics
import
EbicsKeyRing
,
EbicsBank
,
EbicsUser
,
EbicsClient
,
\
EbicsFunctionalError
,
EbicsTechnicalError
,
EbicsVerificationError
fintech
.
cryptolib
=
'
cryptography
'
except
ImportError
:
EbicsBank
=
object
_logger
.
warning
(
'
Failed to import fintech
'
)
class
EbicsXfer
(
models
.
TransientModel
):
_inherit
=
'
ebics.xfer
'
@api.multi
def
ebics_download
(
self
):
self
.
ensure_one
()
self
.
ebics_config_id
.
_check_ebics_files
()
ctx
=
self
.
_context
.
copy
()
_logger
.
info
(
ctx
)
self
.
note
=
''
client
=
self
.
_setup_client
()
_logger
.
info
(
client
)
if
client
:
download_formats
=
(
self
.
format_id
or
self
.
ebics_config_id
.
ebics_file_format_ids
.
filtered
(
lambda
r
:
r
.
type
==
'
down
'
)
)
ebics_files
=
self
.
env
[
'
ebics.file
'
]
date_from
=
self
.
date_from
and
self
.
date_from
.
isoformat
()
or
None
date_to
=
self
.
date_to
and
self
.
date_to
.
isoformat
()
or
None
for
df
in
download_formats
:
try
:
success
=
False
if
df
.
order_type
==
'
FDL
'
:
_logger
.
info
(
df
)
data
=
client
.
FDL
(
df
.
name
,
date_from
,
date_to
)
_logger
.
info
(
data
)
else
:
params
=
None
if
date_from
and
date_to
:
params
=
{
'
DateRange
'
:
{
'
Start
'
:
date_from
,
'
End
'
:
date_to
,
}}
data
=
client
.
download
(
df
.
order_type
,
params
=
params
)
ebics_files
+=
self
.
_handle_download_data
(
data
,
df
)
success
=
True
except
EbicsFunctionalError
:
_logger
.
info
(
"
EbicsFunctionalError
"
)
e
=
exc_info
()
_logger
.
info
(
e
)
self
.
note
+=
'
\n
'
self
.
note
+=
_
(
"
EBICS Functional Error during download of File Format %s (%s):
"
)
%
(
df
.
name
,
df
.
order_type
)
self
.
note
+=
'
\n
'
self
.
note
+=
'
%s (code: %s)
'
%
(
e
[
1
].
message
,
e
[
1
].
code
)
except
EbicsTechnicalError
:
_logger
.
info
(
"
EbicsTechnicalError
"
)
e
=
exc_info
()
_logger
.
info
(
e
)
self
.
note
+=
'
\n
'
self
.
note
+=
_
(
"
EBICS Technical Error during download of File Format %s (%s):
"
)
%
(
df
.
name
,
df
.
order_type
)
self
.
note
+=
'
\n
'
self
.
note
+=
'
%s (code: %s)
'
%
(
e
[
1
].
message
,
e
[
1
].
code
)
except
EbicsVerificationError
:
self
.
note
+=
'
\n
'
self
.
note
+=
_
(
"
EBICS Verification Error during download of
"
"
File Format %s (%s):
"
)
%
(
df
.
name
,
df
.
order_type
)
self
.
note
+=
'
\n
'
self
.
note
+=
_
(
"
The EBICS response could not be verified.
"
)
except
UserError
as
e
:
self
.
note
+=
'
\n
'
self
.
note
+=
_
(
"
Warning during download of File Format %s (%s):
"
)
%
(
df
.
name
,
df
.
order_type
)
self
.
note
+=
'
\n
'
self
.
note
+=
e
.
name
except
Exception
:
self
.
note
+=
'
\n
'
self
.
note
+=
_
(
"
Unknown Error during download of File Format %s (%s):
"
)
%
(
df
.
name
,
df
.
order_type
)
tb
=
''
.
join
(
format_exception
(
*
exc_info
()))
self
.
note
+=
'
\n
%s
'
%
tb
else
:
# mark received data so that it is not included in further
# downloads
trans_id
=
client
.
last_trans_id
client
.
confirm_download
(
trans_id
=
trans_id
,
success
=
success
)
ctx
[
'
ebics_file_ids
'
]
=
ebics_files
.
_ids
if
ebics_files
:
self
.
note
+=
'
\n
'
for
f
in
ebics_files
:
self
.
note
+=
_
(
"
EBICS File
'
%s
'
is available for further processing.
"
)
%
f
.
name
self
.
note
+=
'
\n
'
module
=
__name__
.
split
(
'
addons.
'
)[
1
].
split
(
'
.
'
)[
0
]
result_view
=
self
.
env
.
ref
(
'
%s.ebics_xfer_view_form_result
'
%
module
)
return
{
'
name
'
:
_
(
'
EBICS file transfer result
'
),
'
res_id
'
:
self
.
id
,
'
view_type
'
:
'
form
'
,
'
view_mode
'
:
'
form
'
,
'
res_model
'
:
'
ebics.xfer
'
,
'
view_id
'
:
result_view
.
id
,
'
target
'
:
'
new
'
,
'
context
'
:
ctx
,
'
type
'
:
'
ir.actions.act_window
'
,
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment