mirror of
https://github.com/brain-tec/account_ebics.git
synced 2026-11-06 10:00:39 +00:00
Merge pull request #123 from Noviat/20.0-mig-account_ebics
Syncing from upstream Noviat/account_ebics (20.0-mig-account_ebics)
This commit is contained in:
3 files changed
+27
-30
No files matched your search
@@ -1,7 +1,6 @@
|
|||||||
# Copyright 2009-2025 Noviat.
|
# Copyright 2009-2025 Noviat.
|
||||||
# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
|
# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
|
||||||
|
|
||||||
import base64
|
|
||||||
import logging
|
import logging
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from sys import exc_info
|
from sys import exc_info
|
||||||
@@ -202,7 +201,7 @@ class EbicsFile(models.Model):
|
|||||||
[
|
[
|
||||||
("type", "=", "bank"),
|
("type", "=", "bank"),
|
||||||
(
|
(
|
||||||
"bank_account_id.sanitized_acc_number",
|
"bank_account_id.sanitized_account_number",
|
||||||
"ilike",
|
"ilike",
|
||||||
acc_number,
|
acc_number,
|
||||||
),
|
),
|
||||||
@@ -381,7 +380,7 @@ class EbicsFile(models.Model):
|
|||||||
Statements without transactions are removed.
|
Statements without transactions are removed.
|
||||||
"""
|
"""
|
||||||
datas = []
|
datas = []
|
||||||
file_data = base64.b64decode(self.data).replace(b"\n", b"").replace(b"\r", b"")
|
file_data = bytes(self.data).replace(b"\n", b"").replace(b"\r", b"")
|
||||||
if len(file_data) % 120:
|
if len(file_data) % 120:
|
||||||
message = self.env._(
|
message = self.env._(
|
||||||
"Incorrect CFONB120 file:\nthe file is not divisible in 120 char lines"
|
"Incorrect CFONB120 file:\nthe file is not divisible in 120 char lines"
|
||||||
@@ -413,7 +412,7 @@ class EbicsFile(models.Model):
|
|||||||
"acc_number": acc_number,
|
"acc_number": acc_number,
|
||||||
"journal_id": journal.id,
|
"journal_id": journal.id,
|
||||||
"company_id": journal.company_id.id,
|
"company_id": journal.company_id.id,
|
||||||
"data": base64.b64encode(st_lines),
|
"data": st_lines,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
st_lines = b""
|
st_lines = b""
|
||||||
@@ -500,7 +499,7 @@ class EbicsFile(models.Model):
|
|||||||
.with_context(active_model="ebics.file")
|
.with_context(active_model="ebics.file")
|
||||||
.create({"statement_filename": self.name})
|
.create({"statement_filename": self.name})
|
||||||
)
|
)
|
||||||
wiz.import_single_file(base64.b64decode(st_data["data"]), res)
|
wiz.import_single_file(st_data["data"], res)
|
||||||
|
|
||||||
def _process_bank_statement_oe(self, res, st_datas):
|
def _process_bank_statement_oe(self, res, st_datas):
|
||||||
"""
|
"""
|
||||||
@@ -530,8 +529,7 @@ class EbicsFile(models.Model):
|
|||||||
.create(
|
.create(
|
||||||
{
|
{
|
||||||
"name": self.name,
|
"name": self.name,
|
||||||
"datas": st_data["data"],
|
"raw": st_data["data"],
|
||||||
"store_fname": self.name,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -565,7 +563,7 @@ class EbicsFile(models.Model):
|
|||||||
Statements without transactions are removed.
|
Statements without transactions are removed.
|
||||||
"""
|
"""
|
||||||
datas = []
|
datas = []
|
||||||
file_data = base64.b64decode(self.data)
|
file_data = bytes(self.data)
|
||||||
root = etree.fromstring(file_data, parser=etree.XMLParser(recover=True))
|
root = etree.fromstring(file_data, parser=etree.XMLParser(recover=True))
|
||||||
if root is None:
|
if root is None:
|
||||||
message = self.env._("Invalid XML file.")
|
message = self.env._("Invalid XML file.")
|
||||||
@@ -623,7 +621,7 @@ class EbicsFile(models.Model):
|
|||||||
"acc_number": acc_number,
|
"acc_number": acc_number,
|
||||||
"journal_id": journal.id,
|
"journal_id": journal.id,
|
||||||
"company_id": journal.company_id.id,
|
"company_id": journal.company_id.id,
|
||||||
"data": base64.b64encode(etree.tostring(root_new)),
|
"data": etree.tostring(root_new),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,27 +7,11 @@
|
|||||||
sequence="4"
|
sequence="4"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<menuitem
|
|
||||||
id="ebics_xfer_menu_download"
|
|
||||||
name="EBICS Download"
|
|
||||||
parent="ebics_processing_menu"
|
|
||||||
action="ebics_xfer_action_download"
|
|
||||||
sequence="10"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<menuitem
|
|
||||||
id="ebics_xfer_menu_upload"
|
|
||||||
name="EBICS Upload"
|
|
||||||
parent="ebics_processing_menu"
|
|
||||||
action="ebics_xfer_action_upload"
|
|
||||||
sequence="20"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
id="ebics_file_menu"
|
id="ebics_file_menu"
|
||||||
name="EBICS Files"
|
name="EBICS Files"
|
||||||
parent="ebics_processing_menu"
|
parent="ebics_processing_menu"
|
||||||
sequence="30"
|
sequence="10"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
@@ -46,6 +30,22 @@
|
|||||||
sequence="20"
|
sequence="20"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
id="ebics_xfer_menu_download"
|
||||||
|
name="EBICS Download"
|
||||||
|
parent="ebics_processing_menu"
|
||||||
|
action="ebics_xfer_action_download"
|
||||||
|
sequence="20"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
id="ebics_xfer_menu_upload"
|
||||||
|
name="EBICS Upload"
|
||||||
|
parent="ebics_processing_menu"
|
||||||
|
action="ebics_xfer_action_upload"
|
||||||
|
sequence="30"
|
||||||
|
/>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
id="ebics_menu"
|
id="ebics_menu"
|
||||||
name="EBICS"
|
name="EBICS"
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
# Copyright 2009-2025 Noviat.
|
# Copyright 2009-2025 Noviat.
|
||||||
# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
|
# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
|
||||||
|
|
||||||
import base64
|
|
||||||
import logging
|
import logging
|
||||||
from sys import exc_info
|
from sys import exc_info
|
||||||
from traceback import format_exception
|
from traceback import format_exception
|
||||||
|
|
||||||
from odoo import SUPERUSER_ID, api, fields, models
|
from odoo import SUPERUSER_ID, api, fields, models
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
from odoo.tools.binary import BinaryBytes
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ class EbicsXfer(models.TransientModel):
|
|||||||
self.note = ""
|
self.note = ""
|
||||||
client = self._setup_client()
|
client = self._setup_client()
|
||||||
if client:
|
if client:
|
||||||
upload_data = base64.decodebytes(self.upload_data)
|
upload_data = bytes(self.upload_data)
|
||||||
ef_format = self.format_id
|
ef_format = self.format_id
|
||||||
OrderID = False
|
OrderID = False
|
||||||
try:
|
try:
|
||||||
@@ -619,10 +619,9 @@ class EbicsXfer(models.TransientModel):
|
|||||||
fn,
|
fn,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
data = base64.encodebytes(data)
|
|
||||||
ef_vals = {
|
ef_vals = {
|
||||||
"name": fn,
|
"name": fn,
|
||||||
"data": data,
|
"data": BinaryBytes(data),
|
||||||
"date": fields.Datetime.now(),
|
"date": fields.Datetime.now(),
|
||||||
"date_from": self.date_from,
|
"date_from": self.date_from,
|
||||||
"date_to": self.date_to,
|
"date_to": self.date_to,
|
||||||
|
|||||||
Reference in new issue
Block a user