mirror of
https://github.com/brain-tec/account_ebics.git
synced 2025-01-23 06:41:44 +00:00
[MIG] account_ebics: Migration to 18.0
This commit is contained in:
parent
25c4606a05
commit
56ea15e447
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "EBICS banking protocol",
|
"name": "EBICS banking protocol",
|
||||||
"version": "17.0.1.1.2",
|
"version": "18.0.1.0.0",
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
"author": "Noviat",
|
"author": "Noviat",
|
||||||
"website": "https://www.noviat.com",
|
"website": "https://www.noviat.com",
|
||||||
|
@ -5,7 +5,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from odoo import _, api, fields, models
|
from odoo import api, fields, models
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
@ -132,7 +132,7 @@ class EbicsConfig(models.Model):
|
|||||||
def _check_ebics_key_bitlength(self):
|
def _check_ebics_key_bitlength(self):
|
||||||
for cfg in self:
|
for cfg in self:
|
||||||
if cfg.ebics_version == "H005" and cfg.ebics_key_bitlength < 2048:
|
if cfg.ebics_version == "H005" and cfg.ebics_key_bitlength < 2048:
|
||||||
raise UserError(_("EBICS key bitlength must be >= 2048."))
|
raise UserError(self.env._("EBICS key bitlength must be >= 2048."))
|
||||||
|
|
||||||
@api.constrains("order_number")
|
@api.constrains("order_number")
|
||||||
def _check_order_number(self):
|
def _check_order_number(self):
|
||||||
@ -148,7 +148,7 @@ class EbicsConfig(models.Model):
|
|||||||
ok = False
|
ok = False
|
||||||
if not ok:
|
if not ok:
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_( # pylint: disable=W8120
|
self.env._( # pylint: disable=W8120
|
||||||
"Order Number should comply with the following pattern:"
|
"Order Number should comply with the following pattern:"
|
||||||
"\n[A-Z]{1}[A-Z0-9]{3}"
|
"\n[A-Z]{1}[A-Z0-9]{3}"
|
||||||
)
|
)
|
||||||
@ -178,7 +178,9 @@ class EbicsConfig(models.Model):
|
|||||||
def unlink(self):
|
def unlink(self):
|
||||||
for ebics_config in self:
|
for ebics_config in self:
|
||||||
if ebics_config.state == "active":
|
if ebics_config.state == "active":
|
||||||
raise UserError(_("You cannot remove active EBICS configurations."))
|
raise UserError(
|
||||||
|
self.env._("You cannot remove active EBICS configurations.")
|
||||||
|
)
|
||||||
return super().unlink()
|
return super().unlink()
|
||||||
|
|
||||||
def set_to_draft(self):
|
def set_to_draft(self):
|
||||||
@ -211,7 +213,7 @@ class EbicsConfig(models.Model):
|
|||||||
dirname = self.ebics_keys or ""
|
dirname = self.ebics_keys or ""
|
||||||
if not os.path.exists(dirname):
|
if not os.path.exists(dirname):
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_(
|
self.env._(
|
||||||
"EBICS Keys Root Directory %s is not available."
|
"EBICS Keys Root Directory %s is not available."
|
||||||
"\nPlease contact your system administrator."
|
"\nPlease contact your system administrator."
|
||||||
)
|
)
|
||||||
|
@ -9,7 +9,7 @@ from traceback import format_exception
|
|||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from odoo import _, fields, models
|
from odoo import fields, models
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
from odoo.addons.base.models.res_bank import sanitize_account_number
|
from odoo.addons.base.models.res_bank import sanitize_account_number
|
||||||
@ -86,7 +86,9 @@ class EbicsFile(models.Model):
|
|||||||
ff_methods = self._file_format_methods()
|
ff_methods = self._file_format_methods()
|
||||||
for ebics_file in self:
|
for ebics_file in self:
|
||||||
if ebics_file.state == "done":
|
if ebics_file.state == "done":
|
||||||
raise UserError(_("You can only remove EBICS files in state 'Draft'."))
|
raise UserError(
|
||||||
|
self.env._("You can only remove EBICS files in state 'Draft'.")
|
||||||
|
)
|
||||||
# execute format specific actions
|
# execute format specific actions
|
||||||
ff = ebics_file.format_id.download_process_method
|
ff = ebics_file.format_id.download_process_method
|
||||||
if ff in ff_methods:
|
if ff in ff_methods:
|
||||||
@ -167,7 +169,7 @@ class EbicsFile(models.Model):
|
|||||||
if not mod:
|
if not mod:
|
||||||
if raise_if_not_found:
|
if raise_if_not_found:
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_(
|
self.env._(
|
||||||
"The module to process the '%(ebics_format)s' format is not "
|
"The module to process the '%(ebics_format)s' format is not "
|
||||||
"installed on your system. "
|
"installed on your system. "
|
||||||
"\nPlease install module '%(module)s'",
|
"\nPlease install module '%(module)s'",
|
||||||
@ -184,7 +186,7 @@ class EbicsFile(models.Model):
|
|||||||
)
|
)
|
||||||
journal = self.env["account.journal"]
|
journal = self.env["account.journal"]
|
||||||
if not currency:
|
if not currency:
|
||||||
message = _("Currency %(cc)s not found.", cc=currency_code)
|
message = self.env._("Currency %(cc)s not found.", cc=currency_code)
|
||||||
res["notifications"].append({"type": "error", "message": message})
|
res["notifications"].append({"type": "error", "message": message})
|
||||||
return (currency, journal)
|
return (currency, journal)
|
||||||
|
|
||||||
@ -199,7 +201,7 @@ class EbicsFile(models.Model):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
if not journals:
|
if not journals:
|
||||||
message = _(
|
message = self.env._(
|
||||||
"No financial journal found for Account Number %(nbr)s, "
|
"No financial journal found for Account Number %(nbr)s, "
|
||||||
"Currency %(cc)s",
|
"Currency %(cc)s",
|
||||||
nbr=acc_number,
|
nbr=acc_number,
|
||||||
@ -217,7 +219,7 @@ class EbicsFile(models.Model):
|
|||||||
break
|
break
|
||||||
|
|
||||||
if not journal:
|
if not journal:
|
||||||
message = _(
|
message = self.env._(
|
||||||
"No financial journal found for Account Number %(nbr)s, "
|
"No financial journal found for Account Number %(nbr)s, "
|
||||||
"Currency %(cc)s",
|
"Currency %(cc)s",
|
||||||
nbr=acc_number,
|
nbr=acc_number,
|
||||||
@ -244,7 +246,7 @@ class EbicsFile(models.Model):
|
|||||||
notifications.append(
|
notifications.append(
|
||||||
{
|
{
|
||||||
"type": "warning",
|
"type": "warning",
|
||||||
"message": _("This file doesn't contain any transaction."),
|
"message": self.env._("This file doesn't contain any transaction."),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
st_cnt = len(statements)
|
st_cnt = len(statements)
|
||||||
@ -265,28 +267,30 @@ class EbicsFile(models.Model):
|
|||||||
warning_cnt += 1
|
warning_cnt += 1
|
||||||
warnings.append(notif + "\n")
|
warnings.append(notif + "\n")
|
||||||
|
|
||||||
self.note_process += _("Process file %(fn)s results:", fn=self.name)
|
self.note_process += self.env._("Process file %(fn)s results:", fn=self.name)
|
||||||
if error_cnt:
|
if error_cnt:
|
||||||
self.note_process += "\n\n" + _("Errors") + ":\n"
|
self.note_process += "\n\n" + self.env._("Errors") + ":\n"
|
||||||
self.note_process += "\n".join(errors)
|
self.note_process += "\n".join(errors)
|
||||||
self.note_process += "\n\n"
|
self.note_process += "\n\n"
|
||||||
self.note_process += _("Number of errors: %(nr)s", nr=error_cnt)
|
self.note_process += self.env._("Number of errors: %(nr)s", nr=error_cnt)
|
||||||
if warning_cnt:
|
if warning_cnt:
|
||||||
self.note_process += "\n\n" + _("Warnings") + ":\n"
|
self.note_process += "\n\n" + self.env._("Warnings") + ":\n"
|
||||||
self.note_process += "\n".join(warnings)
|
self.note_process += "\n".join(warnings)
|
||||||
self.note_process += "\n\n"
|
self.note_process += "\n\n"
|
||||||
self.note_process += _("Number of warnings: %(nr)s", nr=warning_cnt)
|
self.note_process += self.env._(
|
||||||
|
"Number of warnings: %(nr)s", nr=warning_cnt
|
||||||
|
)
|
||||||
self.note_process += "\n"
|
self.note_process += "\n"
|
||||||
if st_cnt:
|
if st_cnt:
|
||||||
self.note_process += "\n\n"
|
self.note_process += "\n\n"
|
||||||
self.note_process += _(
|
self.note_process += self.env._(
|
||||||
"%(st_cnt)s bank statement%(sp)s been imported: ",
|
"%(st_cnt)s bank statement%(sp)s been imported: ",
|
||||||
st_cnt=st_cnt,
|
st_cnt=st_cnt,
|
||||||
sp=st_cnt == 1 and _(" has") or _("s have"),
|
sp=st_cnt == 1 and self.env._(" has") or self.env._("s have"),
|
||||||
)
|
)
|
||||||
self.note_process += "\n"
|
self.note_process += "\n"
|
||||||
for statement in statements:
|
for statement in statements:
|
||||||
self.note_process += "\n" + _(
|
self.note_process += "\n" + self.env._(
|
||||||
"Statement %(st)s dated %(date)s (Company: %(cpy)s)",
|
"Statement %(st)s dated %(date)s (Company: %(cpy)s)",
|
||||||
st=statement.name,
|
st=statement.name,
|
||||||
date=statement.date,
|
date=statement.date,
|
||||||
@ -300,7 +304,7 @@ class EbicsFile(models.Model):
|
|||||||
module = __name__.split("addons.")[1].split(".")[0]
|
module = __name__.split("addons.")[1].split(".")[0]
|
||||||
result_view = self.env.ref("%s.ebics_file_view_form_result" % module)
|
result_view = self.env.ref("%s.ebics_file_view_form_result" % module)
|
||||||
return {
|
return {
|
||||||
"name": _("Import EBICS File"),
|
"name": self.env._("Import EBICS File"),
|
||||||
"res_id": self.id,
|
"res_id": self.id,
|
||||||
"view_type": "form",
|
"view_type": "form",
|
||||||
"view_mode": "form",
|
"view_mode": "form",
|
||||||
@ -331,7 +335,7 @@ class EbicsFile(models.Model):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
if dup:
|
if dup:
|
||||||
message = _(
|
message = self.env._(
|
||||||
"Statement %(st_name)s dated %(date)s has already been imported.",
|
"Statement %(st_name)s dated %(date)s has already been imported.",
|
||||||
st_name=statement.name,
|
st_name=statement.name,
|
||||||
date=statement.date,
|
date=statement.date,
|
||||||
@ -369,7 +373,7 @@ class EbicsFile(models.Model):
|
|||||||
file_data = base64.b64decode(self.data)
|
file_data = base64.b64decode(self.data)
|
||||||
file_data.replace(b"\n", b"").replace(b"\r", b"")
|
file_data.replace(b"\n", b"").replace(b"\r", b"")
|
||||||
if len(file_data) % 120:
|
if len(file_data) % 120:
|
||||||
message = _(
|
message = self.env._(
|
||||||
"Incorrect CFONB120 file:\n"
|
"Incorrect CFONB120 file:\n"
|
||||||
"the file is not divisible in 120 char lines"
|
"the file is not divisible in 120 char lines"
|
||||||
)
|
)
|
||||||
@ -450,7 +454,7 @@ class EbicsFile(models.Model):
|
|||||||
break
|
break
|
||||||
if not author:
|
if not author:
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_(
|
self.env._(
|
||||||
"The module to process the '%(ebics_format)s' format is "
|
"The module to process the '%(ebics_format)s' format is "
|
||||||
"not installed on your system. "
|
"not installed on your system. "
|
||||||
"\nPlease install one of the following modules: \n%(modules)s.",
|
"\nPlease install one of the following modules: \n%(modules)s.",
|
||||||
@ -501,7 +505,7 @@ class EbicsFile(models.Model):
|
|||||||
except UserError as e:
|
except UserError as e:
|
||||||
msg = "".join(e.args)
|
msg = "".join(e.args)
|
||||||
msg += "\n"
|
msg += "\n"
|
||||||
msg += _(
|
msg += self.env._(
|
||||||
"Statement for Account Number %(nr)s has not been processed.",
|
"Statement for Account Number %(nr)s has not been processed.",
|
||||||
nr=st_data["acc_number"],
|
nr=st_data["acc_number"],
|
||||||
)
|
)
|
||||||
@ -555,7 +559,7 @@ class EbicsFile(models.Model):
|
|||||||
file_data = base64.b64decode(self.data)
|
file_data = base64.b64decode(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 = _("Invalid XML file.")
|
message = self.env._("Invalid XML file.")
|
||||||
res["notifications"].append({"type": "error", "message": message})
|
res["notifications"].append({"type": "error", "message": message})
|
||||||
ns = {k or "ns": v for k, v in root.nsmap.items()}
|
ns = {k or "ns": v for k, v in root.nsmap.items()}
|
||||||
camt_variant = ns["ns"].split("camt.")[1][:3]
|
camt_variant = ns["ns"].split("camt.")[1][:3]
|
||||||
@ -574,7 +578,7 @@ class EbicsFile(models.Model):
|
|||||||
)[0]
|
)[0]
|
||||||
)
|
)
|
||||||
if not acc_number:
|
if not acc_number:
|
||||||
message = _("No bank account number found.")
|
message = self.env._("No bank account number found.")
|
||||||
res["notifications"].append({"type": "error", "message": message})
|
res["notifications"].append({"type": "error", "message": message})
|
||||||
continue
|
continue
|
||||||
currency_code = stmt.xpath(
|
currency_code = stmt.xpath(
|
||||||
@ -626,7 +630,7 @@ class EbicsFile(models.Model):
|
|||||||
|
|
||||||
def _process_undefined_format(self):
|
def _process_undefined_format(self):
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_(
|
self.env._(
|
||||||
"The current version of the 'account_ebics' module "
|
"The current version of the 'account_ebics' module "
|
||||||
"has no support to automatically process EBICS files "
|
"has no support to automatically process EBICS files "
|
||||||
"with format %s."
|
"with format %s."
|
||||||
|
@ -8,7 +8,7 @@ from sys import exc_info
|
|||||||
from traceback import format_exception
|
from traceback import format_exception
|
||||||
from urllib.error import URLError
|
from urllib.error import URLError
|
||||||
|
|
||||||
from odoo import _, api, fields, models
|
from odoo import api, fields, models
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
@ -236,20 +236,26 @@ class EbicsUserID(models.Model):
|
|||||||
def _check_ebics_key_x509(self):
|
def _check_ebics_key_x509(self):
|
||||||
for cfg in self:
|
for cfg in self:
|
||||||
if cfg.ebics_version == "H005" and not cfg.ebics_key_x509:
|
if cfg.ebics_version == "H005" and not cfg.ebics_key_x509:
|
||||||
raise UserError(_("X.509 certificates must be used with EBICS 3.0."))
|
raise UserError(
|
||||||
|
self.env._("X.509 certificates must be used with EBICS 3.0.")
|
||||||
|
)
|
||||||
|
|
||||||
@api.constrains("ebics_passphrase")
|
@api.constrains("ebics_passphrase")
|
||||||
def _check_ebics_passphrase(self):
|
def _check_ebics_passphrase(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
if rec.ebics_passphrase and len(rec.ebics_passphrase) < 8:
|
if rec.ebics_passphrase and len(rec.ebics_passphrase) < 8:
|
||||||
raise UserError(_("The Passphrase must be at least 8 characters long"))
|
raise UserError(
|
||||||
|
self.env._("The Passphrase must be at least 8 characters long")
|
||||||
|
)
|
||||||
|
|
||||||
@api.constrains("ebics_sig_passphrase")
|
@api.constrains("ebics_sig_passphrase")
|
||||||
def _check_ebics_sig_passphrase(self):
|
def _check_ebics_sig_passphrase(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
if rec.ebics_sig_passphrase and len(rec.ebics_sig_passphrase) < 8:
|
if rec.ebics_sig_passphrase and len(rec.ebics_sig_passphrase) < 8:
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_("The Signature Passphrase must be at least 8 characters long")
|
self.env._(
|
||||||
|
"The Signature Passphrase must be at least 8 characters long"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.onchange("ebics_version")
|
@api.onchange("ebics_version")
|
||||||
@ -280,7 +286,7 @@ class EbicsUserID(models.Model):
|
|||||||
# It will raise a ValueError on invalid passphrases
|
# It will raise a ValueError on invalid passphrases
|
||||||
keyring["#USER"]
|
keyring["#USER"]
|
||||||
except ValueError as err: # noqa: F841
|
except ValueError as err: # noqa: F841
|
||||||
raise UserError(_("Passphrase mismatch.")) # noqa: B904
|
raise UserError(self.env._("Passphrase mismatch.")) # noqa: B904
|
||||||
else:
|
else:
|
||||||
if self.state != "draft":
|
if self.state != "draft":
|
||||||
self.ebics_passphrase = False
|
self.ebics_passphrase = False
|
||||||
@ -302,7 +308,7 @@ class EbicsUserID(models.Model):
|
|||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.ebics_config_id.state != "draft":
|
if self.ebics_config_id.state != "draft":
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_(
|
self.env._(
|
||||||
"Set the EBICS Configuation record to 'Draft' "
|
"Set the EBICS Configuation record to 'Draft' "
|
||||||
"before starting the Key Renewal process."
|
"before starting the Key Renewal process."
|
||||||
)
|
)
|
||||||
@ -317,14 +323,14 @@ class EbicsUserID(models.Model):
|
|||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.state != "draft":
|
if self.state != "draft":
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_("Set state to 'draft' before Bank Key (re)initialisation.")
|
self.env._("Set state to 'draft' before Bank Key (re)initialisation.")
|
||||||
)
|
)
|
||||||
|
|
||||||
if not self.ebics_passphrase:
|
if not self.ebics_passphrase:
|
||||||
raise UserError(_("Set a passphrase."))
|
raise UserError(self.env._("Set a passphrase."))
|
||||||
|
|
||||||
if self.swift_3skey and not self.swift_3skey_certificate:
|
if self.swift_3skey and not self.swift_3skey_certificate:
|
||||||
raise UserError(_("3SKey certificate missing."))
|
raise UserError(self.env._("3SKey certificate missing."))
|
||||||
|
|
||||||
ebics_version = self.ebics_config_id.ebics_version
|
ebics_version = self.ebics_config_id.ebics_version
|
||||||
try:
|
try:
|
||||||
@ -347,7 +353,7 @@ class EbicsUserID(models.Model):
|
|||||||
)
|
)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
exctype, value = exc_info()[:2]
|
exctype, value = exc_info()[:2]
|
||||||
error = _("EBICS Initialisation Error:")
|
error = self.env._("EBICS Initialisation Error:")
|
||||||
error += "\n" + str(exctype) + "\n" + str(value)
|
error += "\n" + str(exctype) + "\n" + str(value)
|
||||||
raise UserError(error) from err
|
raise UserError(error) from err
|
||||||
|
|
||||||
@ -369,13 +375,13 @@ class EbicsUserID(models.Model):
|
|||||||
)
|
)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
exctype, value = exc_info()[:2]
|
exctype, value = exc_info()[:2]
|
||||||
error = _("EBICS Initialisation Error:")
|
error = self.env._("EBICS Initialisation Error:")
|
||||||
error += "\n" + str(exctype) + "\n" + str(value)
|
error += "\n" + str(exctype) + "\n" + str(value)
|
||||||
raise UserError(error) from err
|
raise UserError(error) from err
|
||||||
|
|
||||||
if self.swift_3skey and not self.ebics_key_x509:
|
if self.swift_3skey and not self.ebics_key_x509:
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_(
|
self.env._(
|
||||||
"The current version of this module "
|
"The current version of this module "
|
||||||
"requires to X509 support when enabling 3SKey"
|
"requires to X509 support when enabling 3SKey"
|
||||||
)
|
)
|
||||||
@ -398,7 +404,7 @@ class EbicsUserID(models.Model):
|
|||||||
client = EbicsClient(bank, user, version=ebics_version)
|
client = EbicsClient(bank, user, version=ebics_version)
|
||||||
except RuntimeError as err:
|
except RuntimeError as err:
|
||||||
e = exc_info()
|
e = exc_info()
|
||||||
error = _("EBICS Initialization Error:")
|
error = self.env._("EBICS Initialization Error:")
|
||||||
error += "\n"
|
error += "\n"
|
||||||
error += err.args[0]
|
error += err.args[0]
|
||||||
raise UserError(error) from err
|
raise UserError(error) from err
|
||||||
@ -407,13 +413,15 @@ class EbicsUserID(models.Model):
|
|||||||
ebics_config_bank = self.ebics_config_id.journal_ids[0].bank_id
|
ebics_config_bank = self.ebics_config_id.journal_ids[0].bank_id
|
||||||
if not ebics_config_bank:
|
if not ebics_config_bank:
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_("No bank defined for the financial journal " "of the EBICS Config")
|
self.env._(
|
||||||
|
"No bank defined for the financial journal " "of the EBICS Config"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
supported_versions = client.HEV()
|
supported_versions = client.HEV()
|
||||||
if supported_versions and ebics_version not in supported_versions:
|
if supported_versions and ebics_version not in supported_versions:
|
||||||
err_msg = _("EBICS version mismatch.") + "\n"
|
err_msg = self.env._("EBICS version mismatch.") + "\n"
|
||||||
err_msg += _("Versions supported by your bank:")
|
err_msg += self.env._("Versions supported by your bank:")
|
||||||
for k in supported_versions:
|
for k in supported_versions:
|
||||||
err_msg += f"\n{k}: {supported_versions[k]} "
|
err_msg += f"\n{k}: {supported_versions[k]} "
|
||||||
raise UserError(err_msg)
|
raise UserError(err_msg)
|
||||||
@ -432,7 +440,7 @@ class EbicsUserID(models.Model):
|
|||||||
tb,
|
tb,
|
||||||
)
|
)
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_(
|
self.env._(
|
||||||
"urlopen error:\n url '%(url)s' - %(val)s",
|
"urlopen error:\n url '%(url)s' - %(val)s",
|
||||||
url=self.ebics_config_id.ebics_url,
|
url=self.ebics_config_id.ebics_url,
|
||||||
val=str(value),
|
val=str(value),
|
||||||
@ -440,13 +448,13 @@ class EbicsUserID(models.Model):
|
|||||||
) from err
|
) from err
|
||||||
except EbicsFunctionalError as err:
|
except EbicsFunctionalError as err:
|
||||||
e = exc_info()
|
e = exc_info()
|
||||||
error = _("EBICS Functional Error:")
|
error = self.env._("EBICS Functional Error:")
|
||||||
error += "\n"
|
error += "\n"
|
||||||
error += f"{e[1].message} (code: {e[1].code})"
|
error += f"{e[1].message} (code: {e[1].code})"
|
||||||
raise UserError(error) from err
|
raise UserError(error) from err
|
||||||
except EbicsTechnicalError as err:
|
except EbicsTechnicalError as err:
|
||||||
e = exc_info()
|
e = exc_info()
|
||||||
error = _("EBICS Technical Error:")
|
error = self.env._("EBICS Technical Error:")
|
||||||
error += "\n"
|
error += "\n"
|
||||||
error += f"{e[1].message} (code: {e[1].code})"
|
error += f"{e[1].message} (code: {e[1].code})"
|
||||||
raise UserError(error) from err
|
raise UserError(error) from err
|
||||||
@ -485,7 +493,7 @@ class EbicsUserID(models.Model):
|
|||||||
"""
|
"""
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.state != "init":
|
if self.state != "init":
|
||||||
raise UserError(_("Set state to 'Initialisation'."))
|
raise UserError(self.env._("Set state to 'Initialisation'."))
|
||||||
vals = {"state": "get_bank_keys"}
|
vals = {"state": "get_bank_keys"}
|
||||||
self._update_passphrase_vals(vals)
|
self._update_passphrase_vals(vals)
|
||||||
return self.write(vals)
|
return self.write(vals)
|
||||||
@ -499,7 +507,7 @@ class EbicsUserID(models.Model):
|
|||||||
"""
|
"""
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.state != "get_bank_keys":
|
if self.state != "get_bank_keys":
|
||||||
raise UserError(_("Set state to 'Get Keys from Bank'."))
|
raise UserError(self.env._("Set state to 'Get Keys from Bank'."))
|
||||||
try:
|
try:
|
||||||
keyring = EbicsKeyRing(
|
keyring = EbicsKeyRing(
|
||||||
keys=self.ebics_keys_fn, passphrase=self.ebics_passphrase
|
keys=self.ebics_keys_fn, passphrase=self.ebics_passphrase
|
||||||
@ -517,7 +525,7 @@ class EbicsUserID(models.Model):
|
|||||||
client = EbicsClient(bank, user, version=self.ebics_config_id.ebics_version)
|
client = EbicsClient(bank, user, version=self.ebics_config_id.ebics_version)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
exctype, value = exc_info()[:2]
|
exctype, value = exc_info()[:2]
|
||||||
error = _("EBICS Initialisation Error:")
|
error = self.env._("EBICS Initialisation Error:")
|
||||||
error += "\n" + str(exctype) + "\n" + str(value)
|
error += "\n" + str(exctype) + "\n" + str(value)
|
||||||
raise UserError(error) from err
|
raise UserError(error) from err
|
||||||
|
|
||||||
@ -525,13 +533,13 @@ class EbicsUserID(models.Model):
|
|||||||
public_bank_keys = client.HPB()
|
public_bank_keys = client.HPB()
|
||||||
except EbicsFunctionalError as err:
|
except EbicsFunctionalError as err:
|
||||||
e = exc_info()
|
e = exc_info()
|
||||||
error = _("EBICS Functional Error:")
|
error = self.env._("EBICS Functional Error:")
|
||||||
error += "\n"
|
error += "\n"
|
||||||
error += f"{e[1].message} (code: {e[1].code})"
|
error += f"{e[1].message} (code: {e[1].code})"
|
||||||
raise UserError(error) from err
|
raise UserError(error) from err
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
exctype, value = exc_info()[:2]
|
exctype, value = exc_info()[:2]
|
||||||
error = _("EBICS Initialisation Error:")
|
error = self.env._("EBICS Initialisation Error:")
|
||||||
error += "\n" + str(exctype) + "\n" + str(value)
|
error += "\n" + str(exctype) + "\n" + str(value)
|
||||||
raise UserError(error) from err
|
raise UserError(error) from err
|
||||||
|
|
||||||
@ -557,7 +565,7 @@ class EbicsUserID(models.Model):
|
|||||||
"""
|
"""
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.state != "to_verify":
|
if self.state != "to_verify":
|
||||||
raise UserError(_("Set state to 'Verification'."))
|
raise UserError(self.env._("Set state to 'Verification'."))
|
||||||
|
|
||||||
keyring = EbicsKeyRing(
|
keyring = EbicsKeyRing(
|
||||||
keys=self.ebics_keys_fn, passphrase=self.ebics_passphrase
|
keys=self.ebics_keys_fn, passphrase=self.ebics_passphrase
|
||||||
@ -578,7 +586,7 @@ class EbicsUserID(models.Model):
|
|||||||
module = __name__.split("addons.")[1].split(".")[0]
|
module = __name__.split("addons.")[1].split(".")[0]
|
||||||
view = self.env.ref("%s.ebics_change_passphrase_view_form" % module)
|
view = self.env.ref("%s.ebics_change_passphrase_view_form" % module)
|
||||||
return {
|
return {
|
||||||
"name": _("EBICS keys change passphrase"),
|
"name": self.env._("EBICS keys change passphrase"),
|
||||||
"view_type": "form",
|
"view_type": "form",
|
||||||
"view_mode": "form",
|
"view_mode": "form",
|
||||||
"res_model": "ebics.change.passphrase",
|
"res_model": "ebics.change.passphrase",
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
<?xml version="1.0" ?>
|
<?xml version="1.0" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="ebics_config_view_tree" model="ir.ui.view">
|
<record id="ebics_config_view_list" model="ir.ui.view">
|
||||||
<field name="name">ebics.config.tree</field>
|
<field name="name">ebics.config.list</field>
|
||||||
<field name="model">ebics.config</field>
|
<field name="model">ebics.config</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree decoration-muted="state == 'draft'">
|
<list decoration-muted="state == 'draft'">
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="ebics_host" />
|
<field name="ebics_host" />
|
||||||
<field name="state" />
|
<field name="state" />
|
||||||
<field name="active" />
|
<field name="active" />
|
||||||
</tree>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@ -39,7 +39,6 @@
|
|||||||
/>
|
/>
|
||||||
<field name="state" widget="statusbar" />
|
<field name="state" widget="statusbar" />
|
||||||
</header>
|
</header>
|
||||||
<field name="active" invisible="1" />
|
|
||||||
<widget
|
<widget
|
||||||
name="web_ribbon"
|
name="web_ribbon"
|
||||||
text="Archived"
|
text="Archived"
|
||||||
@ -69,7 +68,6 @@
|
|||||||
invisible="ebics_version != 'H003'"
|
invisible="ebics_version != 'H003'"
|
||||||
readonly="state != 'draft'"
|
readonly="state != 'draft'"
|
||||||
/>
|
/>
|
||||||
<field name="company_ids" widget="many2many_tags" invisible="1" />
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<notebook>
|
<notebook>
|
||||||
@ -87,7 +85,7 @@
|
|||||||
<record id="ebics_config_action" model="ir.actions.act_window">
|
<record id="ebics_config_action" model="ir.actions.act_window">
|
||||||
<field name="name">EBICS Configuration</field>
|
<field name="name">EBICS Configuration</field>
|
||||||
<field name="res_model">ebics.config</field>
|
<field name="res_model">ebics.config</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">list,form</field>
|
||||||
<field name="context">{'active_test': False}</field>
|
<field name="context">{'active_test': False}</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?xml version="1.0" ?>
|
<?xml version="1.0" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="ebics_file_format_view_tree" model="ir.ui.view">
|
<record id="ebics_file_format_view_list" model="ir.ui.view">
|
||||||
<field name="name">ebics.file.format.tree</field>
|
<field name="name">ebics.file.format.list</field>
|
||||||
<field name="model">ebics.file.format</field>
|
<field name="model">ebics.file.format</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree>
|
<list>
|
||||||
<field name="ebics_version" />
|
<field name="ebics_version" />
|
||||||
<field name="type" />
|
<field name="type" />
|
||||||
<field name="order_type" />
|
<field name="order_type" />
|
||||||
<field name="signature_class" />
|
<field name="signature_class" />
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="description" />
|
<field name="description" />
|
||||||
</tree>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@ -68,7 +68,7 @@
|
|||||||
<record id="ebics_file_format_action" model="ir.actions.act_window">
|
<record id="ebics_file_format_action" model="ir.actions.act_window">
|
||||||
<field name="name">EBICS File Formats</field>
|
<field name="name">EBICS File Formats</field>
|
||||||
<field name="res_model">ebics.file.format</field>
|
<field name="res_model">ebics.file.format</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">list,form</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
@ -34,11 +34,11 @@
|
|||||||
|
|
||||||
<!-- Download -->
|
<!-- Download -->
|
||||||
|
|
||||||
<record id="ebics_file_view_tree_download" model="ir.ui.view">
|
<record id="ebics_file_view_list_download" model="ir.ui.view">
|
||||||
<field name="name">ebics.file.tree</field>
|
<field name="name">ebics.file.list</field>
|
||||||
<field name="model">ebics.file</field>
|
<field name="model">ebics.file</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree decoration-muted="state=='draft'" create="false">
|
<list decoration-muted="state=='draft'" create="false">
|
||||||
<field name="date" string="Download Date" />
|
<field name="date" string="Download Date" />
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="date_from" />
|
<field name="date_from" />
|
||||||
@ -51,7 +51,7 @@
|
|||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
groups="base.group_multi_company"
|
groups="base.group_multi_company"
|
||||||
/>
|
/>
|
||||||
</tree>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@ -140,16 +140,16 @@
|
|||||||
<field name="name">EBICS Download Files</field>
|
<field name="name">EBICS Download Files</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="res_model">ebics.file</field>
|
<field name="res_model">ebics.file</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">list,form</field>
|
||||||
<field name="view_id" eval="False" />
|
<field name="view_id" eval="False" />
|
||||||
<field name="domain">[('type','=','down')]</field>
|
<field name="domain">[('type','=','down')]</field>
|
||||||
<field name="search_view_id" ref="ebics_file_view_search" />
|
<field name="search_view_id" ref="ebics_file_view_search" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="ebics_file_action_download_tree" model="ir.actions.act_window.view">
|
<record id="ebics_file_action_download_list" model="ir.actions.act_window.view">
|
||||||
<field eval="1" name="sequence" />
|
<field eval="1" name="sequence" />
|
||||||
<field name="view_mode">tree</field>
|
<field name="view_mode">list</field>
|
||||||
<field name="view_id" ref="ebics_file_view_tree_download" />
|
<field name="view_id" ref="ebics_file_view_list_download" />
|
||||||
<field name="act_window_id" ref="ebics_file_action_download" />
|
<field name="act_window_id" ref="ebics_file_action_download" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@ -162,11 +162,11 @@
|
|||||||
|
|
||||||
<!-- Upload -->
|
<!-- Upload -->
|
||||||
|
|
||||||
<record id="ebics_file_view_tree_upload" model="ir.ui.view">
|
<record id="ebics_file_view_list_upload" model="ir.ui.view">
|
||||||
<field name="name">ebics.file.tree</field>
|
<field name="name">ebics.file.list</field>
|
||||||
<field name="model">ebics.file</field>
|
<field name="model">ebics.file</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree decoration-muted="state=='draft'" create="false">
|
<list decoration-muted="state=='draft'" create="false">
|
||||||
<field name="date" string="Upload Date" />
|
<field name="date" string="Upload Date" />
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="user_id" />
|
<field name="user_id" />
|
||||||
@ -177,7 +177,7 @@
|
|||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
groups="base.group_multi_company"
|
groups="base.group_multi_company"
|
||||||
/>
|
/>
|
||||||
</tree>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@ -230,16 +230,16 @@
|
|||||||
<field name="name">EBICS Upload Files</field>
|
<field name="name">EBICS Upload Files</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="res_model">ebics.file</field>
|
<field name="res_model">ebics.file</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">list,form</field>
|
||||||
<field name="view_id" eval="False" />
|
<field name="view_id" eval="False" />
|
||||||
<field name="domain">[('type','=','up')]</field>
|
<field name="domain">[('type','=','up')]</field>
|
||||||
<field name="search_view_id" ref="ebics_file_view_search" />
|
<field name="search_view_id" ref="ebics_file_view_search" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="ebics_file_action_upload_tree" model="ir.actions.act_window.view">
|
<record id="ebics_file_action_upload_list" model="ir.actions.act_window.view">
|
||||||
<field eval="1" name="sequence" />
|
<field eval="1" name="sequence" />
|
||||||
<field name="view_mode">tree</field>
|
<field name="view_mode">list</field>
|
||||||
<field name="view_id" ref="ebics_file_view_tree_upload" />
|
<field name="view_id" ref="ebics_file_view_list_upload" />
|
||||||
<field name="act_window_id" ref="ebics_file_action_upload" />
|
<field name="act_window_id" ref="ebics_file_action_upload" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
<?xml version="1.0" ?>
|
<?xml version="1.0" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="ebics_userid_view_tree" model="ir.ui.view">
|
<record id="ebics_userid_view_list" model="ir.ui.view">
|
||||||
<field name="name">ebics.userid.tree</field>
|
<field name="name">ebics.userid.list</field>
|
||||||
<field name="model">ebics.userid</field>
|
<field name="model">ebics.userid</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree decoration-muted="state != 'active_keys'">
|
<list decoration-muted="state != 'active_keys'">
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="signature_class" />
|
<field name="signature_class" />
|
||||||
<field name="state" />
|
<field name="state" />
|
||||||
<field name="active" />
|
<field name="active" />
|
||||||
</tree>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@ -82,16 +82,6 @@
|
|||||||
/>
|
/>
|
||||||
<field name="state" widget="statusbar" />
|
<field name="state" widget="statusbar" />
|
||||||
</header>
|
</header>
|
||||||
<group name="invisible" invisible="1">
|
|
||||||
<field name="ebics_config_id" />
|
|
||||||
<field name="ebics_keys_found" />
|
|
||||||
<field name="ebics_keys_fn" />
|
|
||||||
<field name="ebics_version" />
|
|
||||||
<field name="ebics_passphrase_required" />
|
|
||||||
<field name="ebics_passphrase_invisible" />
|
|
||||||
<field name="ebics_passphrase_store_readonly" />
|
|
||||||
<field name="ebics_sig_passphrase_invisible" invisible="1" />
|
|
||||||
</group>
|
|
||||||
<group name="main" readonly="state != 'draft'">
|
<group name="main" readonly="state != 'draft'">
|
||||||
<group name="main-left">
|
<group name="main-left">
|
||||||
<field name="name" readonly="state != 'draft'" />
|
<field name="name" readonly="state != 'draft'" />
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import pprint
|
import pprint
|
||||||
|
|
||||||
from odoo import _, api, fields, models
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class EbicsAdminOrder(models.TransientModel):
|
class EbicsAdminOrder(models.TransientModel):
|
||||||
@ -30,7 +30,7 @@ class EbicsAdminOrder(models.TransientModel):
|
|||||||
client = self._setup_client()
|
client = self._setup_client()
|
||||||
if not client:
|
if not client:
|
||||||
self.note += (
|
self.note += (
|
||||||
_("EBICS client setup failed for connection '%s'")
|
self.env._("EBICS client setup failed for connection '%s'")
|
||||||
% self.ebics_config_id.name
|
% self.ebics_config_id.name
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -40,7 +40,7 @@ class EbicsAdminOrder(models.TransientModel):
|
|||||||
module = __name__.split("addons.")[1].split(".")[0]
|
module = __name__.split("addons.")[1].split(".")[0]
|
||||||
result_view = self.env.ref("%s.ebics_admin_order_view_form_result" % module)
|
result_view = self.env.ref("%s.ebics_admin_order_view_form_result" % module)
|
||||||
return {
|
return {
|
||||||
"name": _("EBICS Administrative Order result"),
|
"name": self.env._("EBICS Administrative Order result"),
|
||||||
"res_id": self.id,
|
"res_id": self.id,
|
||||||
"view_type": "form",
|
"view_type": "form",
|
||||||
"view_mode": "form",
|
"view_mode": "form",
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from odoo import _, fields, models
|
from odoo import fields, models
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
@ -50,21 +50,23 @@ class EbicsChangePassphrase(models.TransientModel):
|
|||||||
and self.old_pass
|
and self.old_pass
|
||||||
and self.old_pass != self.ebics_userid_id.ebics_passphrase
|
and self.old_pass != self.ebics_userid_id.ebics_passphrase
|
||||||
):
|
):
|
||||||
raise UserError(_("Incorrect old passphrase."))
|
raise UserError(self.env._("Incorrect old passphrase."))
|
||||||
if self.new_pass != self.new_pass_check:
|
if self.new_pass != self.new_pass_check:
|
||||||
raise UserError(_("New passphrase verification error."))
|
raise UserError(self.env._("New passphrase verification error."))
|
||||||
if self.new_pass and self.new_pass == self.ebics_userid_id.ebics_passphrase:
|
if self.new_pass and self.new_pass == self.ebics_userid_id.ebics_passphrase:
|
||||||
raise UserError(_("New passphrase equal to old passphrase."))
|
raise UserError(self.env._("New passphrase equal to old passphrase."))
|
||||||
if (
|
if (
|
||||||
self.new_sig_pass
|
self.new_sig_pass
|
||||||
and self.old_sig_pass
|
and self.old_sig_pass
|
||||||
and self.new_sig_pass == self.old_sig_pass
|
and self.new_sig_pass == self.old_sig_pass
|
||||||
):
|
):
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_("New signature passphrase equal to old signature passphrase.")
|
self.env._(
|
||||||
|
"New signature passphrase equal to old signature passphrase."
|
||||||
|
)
|
||||||
)
|
)
|
||||||
if self.new_sig_pass != self.new_sig_pass_check:
|
if self.new_sig_pass != self.new_sig_pass_check:
|
||||||
raise UserError(_("New signature passphrase verification error."))
|
raise UserError(self.env._("New signature passphrase verification error."))
|
||||||
passphrase = (
|
passphrase = (
|
||||||
self.ebics_userid_id.ebics_passphrase_store
|
self.ebics_userid_id.ebics_passphrase_store
|
||||||
and self.ebics_userid_id.ebics_passphrase
|
and self.ebics_userid_id.ebics_passphrase
|
||||||
@ -105,7 +107,7 @@ class EbicsChangePassphrase(models.TransientModel):
|
|||||||
"%s.ebics_change_passphrase_view_form_result" % module
|
"%s.ebics_change_passphrase_view_form_result" % module
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
"name": _("EBICS Keys Change Passphrase"),
|
"name": self.env._("EBICS Keys Change Passphrase"),
|
||||||
"res_id": self.id,
|
"res_id": self.id,
|
||||||
"view_type": "form",
|
"view_type": "form",
|
||||||
"view_mode": "form",
|
"view_mode": "form",
|
||||||
|
@ -18,9 +18,6 @@
|
|||||||
<field name="new_sig_pass" password="True" />
|
<field name="new_sig_pass" password="True" />
|
||||||
<field name="new_sig_pass_check" password="True" />
|
<field name="new_sig_pass_check" password="True" />
|
||||||
</group>
|
</group>
|
||||||
<group name="invisible" invisible="1">
|
|
||||||
<field name="ebics_sig_passphrase_invisible" />
|
|
||||||
</group>
|
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button
|
<button
|
||||||
|
@ -6,7 +6,7 @@ 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 _, api, fields, models
|
from odoo import api, fields, models
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
@ -203,7 +203,7 @@ class EbicsXfer(models.TransientModel):
|
|||||||
module = __name__.split("addons.")[1].split(".")[0]
|
module = __name__.split("addons.")[1].split(".")[0]
|
||||||
result_view = self.env.ref("%s.ebics_xfer_view_form_result" % module)
|
result_view = self.env.ref("%s.ebics_xfer_view_form_result" % module)
|
||||||
return {
|
return {
|
||||||
"name": _("EBICS file transfer result"),
|
"name": self.env._("EBICS file transfer result"),
|
||||||
"res_id": self.id,
|
"res_id": self.id,
|
||||||
"view_type": "form",
|
"view_type": "form",
|
||||||
"view_mode": "form",
|
"view_mode": "form",
|
||||||
@ -223,7 +223,7 @@ class EbicsXfer(models.TransientModel):
|
|||||||
if not client:
|
if not client:
|
||||||
err_cnt += 1
|
err_cnt += 1
|
||||||
self.note += (
|
self.note += (
|
||||||
_("EBICS client setup failed for connection '%s'")
|
self.env._("EBICS client setup failed for connection '%s'")
|
||||||
% self.ebics_config_id.name
|
% self.ebics_config_id.name
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -269,7 +269,7 @@ class EbicsXfer(models.TransientModel):
|
|||||||
err_cnt += 1
|
err_cnt += 1
|
||||||
e = exc_info()
|
e = exc_info()
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _(
|
self.note += self.env._(
|
||||||
"EBICS Functional Error during download of "
|
"EBICS Functional Error during download of "
|
||||||
"File Format %(name)s (%(order_type)s):",
|
"File Format %(name)s (%(order_type)s):",
|
||||||
name=df.name or df.description,
|
name=df.name or df.description,
|
||||||
@ -281,7 +281,7 @@ class EbicsXfer(models.TransientModel):
|
|||||||
err_cnt += 1
|
err_cnt += 1
|
||||||
e = exc_info()
|
e = exc_info()
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _(
|
self.note += self.env._(
|
||||||
"EBICS Technical Error during download of "
|
"EBICS Technical Error during download of "
|
||||||
"File Format %(name)s (%(order_type)s):",
|
"File Format %(name)s (%(order_type)s):",
|
||||||
name=df.name or df.description,
|
name=df.name or df.description,
|
||||||
@ -292,18 +292,18 @@ class EbicsXfer(models.TransientModel):
|
|||||||
except EbicsVerificationError:
|
except EbicsVerificationError:
|
||||||
err_cnt += 1
|
err_cnt += 1
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _(
|
self.note += self.env._(
|
||||||
"EBICS Verification Error during download of "
|
"EBICS Verification Error during download of "
|
||||||
"File Format %(name)s (%(order_type)s):",
|
"File Format %(name)s (%(order_type)s):",
|
||||||
name=df.name or df.description,
|
name=df.name or df.description,
|
||||||
order_type=df.order_type,
|
order_type=df.order_type,
|
||||||
)
|
)
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _("The EBICS response could not be verified.")
|
self.note += self.env._("The EBICS response could not be verified.")
|
||||||
except UserError as e:
|
except UserError as e:
|
||||||
err_cnt += 1
|
err_cnt += 1
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _(
|
self.note += self.env._(
|
||||||
"Error detected during download of "
|
"Error detected during download of "
|
||||||
"File Format %(name)s (%(order_type)s):",
|
"File Format %(name)s (%(order_type)s):",
|
||||||
name=df.name or df.description,
|
name=df.name or df.description,
|
||||||
@ -314,7 +314,7 @@ class EbicsXfer(models.TransientModel):
|
|||||||
except Exception:
|
except Exception:
|
||||||
err_cnt += 1
|
err_cnt += 1
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _(
|
self.note += self.env._(
|
||||||
"Unknown Error during download of "
|
"Unknown Error during download of "
|
||||||
"File Format %(name)s (%(order_type)s):",
|
"File Format %(name)s (%(order_type)s):",
|
||||||
name=df.name or df.description,
|
name=df.name or df.description,
|
||||||
@ -334,7 +334,9 @@ class EbicsXfer(models.TransientModel):
|
|||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
for f in ebics_files:
|
for f in ebics_files:
|
||||||
self.note += (
|
self.note += (
|
||||||
_("EBICS File '%s' is available for further processing.")
|
self.env._(
|
||||||
|
"EBICS File '%s' is available for further processing."
|
||||||
|
)
|
||||||
% f.name
|
% f.name
|
||||||
)
|
)
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
@ -343,7 +345,7 @@ class EbicsXfer(models.TransientModel):
|
|||||||
module = __name__.split("addons.")[1].split(".")[0]
|
module = __name__.split("addons.")[1].split(".")[0]
|
||||||
result_view = self.env.ref("%s.ebics_xfer_view_form_result" % module)
|
result_view = self.env.ref("%s.ebics_xfer_view_form_result" % module)
|
||||||
return {
|
return {
|
||||||
"name": _("EBICS file transfer result"),
|
"name": self.env._("EBICS file transfer result"),
|
||||||
"res_id": self.id,
|
"res_id": self.id,
|
||||||
"view_type": "form",
|
"view_type": "form",
|
||||||
"view_mode": "form",
|
"view_mode": "form",
|
||||||
@ -403,11 +405,14 @@ class EbicsXfer(models.TransientModel):
|
|||||||
if OrderID:
|
if OrderID:
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += (
|
self.note += (
|
||||||
_("EBICS File has been uploaded (OrderID %s).") % OrderID
|
self.env._("EBICS File has been uploaded (OrderID %s).")
|
||||||
|
% OrderID
|
||||||
)
|
)
|
||||||
ef_note = _("EBICS OrderID: %s") % OrderID
|
ef_note = self.env._("EBICS OrderID: %s") % OrderID
|
||||||
if self.env.context.get("origin"):
|
if self.env.context.get("origin"):
|
||||||
ef_note += "\n" + _("Origin: %s") % self._context["origin"]
|
ef_note += (
|
||||||
|
"\n" + self.env._("Origin: %s") % self._context["origin"]
|
||||||
|
)
|
||||||
suffix = self.format_id.suffix
|
suffix = self.format_id.suffix
|
||||||
fn = self.upload_fname
|
fn = self.upload_fname
|
||||||
if suffix and not fn.endswith(suffix):
|
if suffix and not fn.endswith(suffix):
|
||||||
@ -431,23 +436,23 @@ class EbicsXfer(models.TransientModel):
|
|||||||
except EbicsFunctionalError:
|
except EbicsFunctionalError:
|
||||||
e = exc_info()
|
e = exc_info()
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _("EBICS Functional Error:")
|
self.note += self.env._("EBICS Functional Error:")
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += f"{e[1].message} (code: {e[1].code})"
|
self.note += f"{e[1].message} (code: {e[1].code})"
|
||||||
except EbicsTechnicalError:
|
except EbicsTechnicalError:
|
||||||
e = exc_info()
|
e = exc_info()
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _("EBICS Technical Error:")
|
self.note += self.env._("EBICS Technical Error:")
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += f"{e[1].message} (code: {e[1].code})"
|
self.note += f"{e[1].message} (code: {e[1].code})"
|
||||||
except EbicsVerificationError:
|
except EbicsVerificationError:
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _("EBICS Verification Error:")
|
self.note += self.env._("EBICS Verification Error:")
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _("The EBICS response could not be verified.")
|
self.note += self.env._("The EBICS response could not be verified.")
|
||||||
except Exception:
|
except Exception:
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _("Unknown Error")
|
self.note += self.env._("Unknown Error")
|
||||||
tb = "".join(format_exception(*exc_info()))
|
tb = "".join(format_exception(*exc_info()))
|
||||||
self.note += "\n%s" % tb
|
self.note += "\n%s" % tb
|
||||||
|
|
||||||
@ -478,7 +483,7 @@ class EbicsXfer(models.TransientModel):
|
|||||||
try:
|
try:
|
||||||
keyring = EbicsKeyRing(**keyring_params)
|
keyring = EbicsKeyRing(**keyring_params)
|
||||||
except (RuntimeError, ValueError) as err:
|
except (RuntimeError, ValueError) as err:
|
||||||
error = _("Error while accessing the EBICS Keys:")
|
error = self.env._("Error while accessing the EBICS Keys:")
|
||||||
error += "\n"
|
error += "\n"
|
||||||
error += err.args[0]
|
error += err.args[0]
|
||||||
raise UserError(error) from err
|
raise UserError(error) from err
|
||||||
@ -507,13 +512,15 @@ class EbicsXfer(models.TransientModel):
|
|||||||
try:
|
try:
|
||||||
user = EbicsUser(**user_params)
|
user = EbicsUser(**user_params)
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
error = _("Error while accessing the EBICS UserID:")
|
error = self.env._("Error while accessing the EBICS UserID:")
|
||||||
error += "\n"
|
error += "\n"
|
||||||
err_str = err.args[0]
|
err_str = err.args[0]
|
||||||
error += err.args[0]
|
error += err.args[0]
|
||||||
if err_str == "unknown key format":
|
if err_str == "unknown key format":
|
||||||
error += "\n"
|
error += "\n"
|
||||||
error += _("Doublecheck your EBICS Passphrase and UserID settings.")
|
error += self.env._(
|
||||||
|
"Doublecheck your EBICS Passphrase and UserID settings."
|
||||||
|
)
|
||||||
raise UserError(error) from err
|
raise UserError(error) from err
|
||||||
# manual_approval replaced by transport_only class param in fintech 7.4
|
# manual_approval replaced by transport_only class param in fintech 7.4
|
||||||
if not fintech74 and signature_class == "T":
|
if not fintech74 and signature_class == "T":
|
||||||
@ -523,7 +530,7 @@ class EbicsXfer(models.TransientModel):
|
|||||||
client = EbicsClient(bank, user, version=self.ebics_config_id.ebics_version)
|
client = EbicsClient(bank, user, version=self.ebics_config_id.ebics_version)
|
||||||
except Exception:
|
except Exception:
|
||||||
self.note += "\n"
|
self.note += "\n"
|
||||||
self.note += _("Unknown Error")
|
self.note += self.env._("Unknown Error")
|
||||||
tb = "".join(format_exception(*exc_info()))
|
tb = "".join(format_exception(*exc_info()))
|
||||||
self.note += "\n%s" % tb
|
self.note += "\n%s" % tb
|
||||||
client = False
|
client = False
|
||||||
@ -590,7 +597,7 @@ class EbicsXfer(models.TransientModel):
|
|||||||
dups = self._check_duplicate_ebics_file(fn, file_format)
|
dups = self._check_duplicate_ebics_file(fn, file_format)
|
||||||
if dups:
|
if dups:
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_(
|
self.env._(
|
||||||
"EBICS File with name '%s' has already been downloaded."
|
"EBICS File with name '%s' has already been downloaded."
|
||||||
"\nPlease check this file and rename in case there is "
|
"\nPlease check this file and rename in case there is "
|
||||||
"no risk on duplicate transactions."
|
"no risk on duplicate transactions."
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
invisible="ebics_passphrase_store"
|
invisible="ebics_passphrase_store"
|
||||||
required="not ebics_passphrase_store"
|
required="not ebics_passphrase_store"
|
||||||
/>
|
/>
|
||||||
<field name="ebics_passphrase_store" invisible="1" />
|
|
||||||
<field name="date_from" />
|
<field name="date_from" />
|
||||||
<field name="date_to" />
|
<field name="date_to" />
|
||||||
<field
|
<field
|
||||||
@ -34,7 +33,6 @@
|
|||||||
domain="[('type', '=', 'down'), ('id', 'in', allowed_format_ids)]"
|
domain="[('type', '=', 'down'), ('id', 'in', allowed_format_ids)]"
|
||||||
/>
|
/>
|
||||||
<field name="order_type" />
|
<field name="order_type" />
|
||||||
<field name="allowed_format_ids" invisible="1" />
|
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button
|
<button
|
||||||
@ -85,13 +83,10 @@
|
|||||||
password="True"
|
password="True"
|
||||||
invisible="ebics_sig_passphrase_invisible"
|
invisible="ebics_sig_passphrase_invisible"
|
||||||
/>
|
/>
|
||||||
<field name="ebics_passphrase_store" invisible="1" />
|
|
||||||
<field name="ebics_sig_passphrase_invisible" invisible="1" />
|
|
||||||
<separator string="Select your file :" colspan="2" />
|
<separator string="Select your file :" colspan="2" />
|
||||||
<field name="upload_data" filename="upload_fname" required="1" />
|
<field name="upload_data" filename="upload_fname" required="1" />
|
||||||
<field name="upload_fname" invisible="1" />
|
<field name="upload_fname" invisible="1" />
|
||||||
<field name="upload_fname_dummy" string="Upload Filename" />
|
<field name="upload_fname_dummy" string="Upload Filename" />
|
||||||
<field name="upload_format_ids" invisible="1" />
|
|
||||||
<field
|
<field
|
||||||
name="format_id"
|
name="format_id"
|
||||||
required="1"
|
required="1"
|
||||||
@ -100,7 +95,6 @@
|
|||||||
/>
|
/>
|
||||||
<field name="order_type" />
|
<field name="order_type" />
|
||||||
<field name="test_mode" invisible="order_type not in ('FUL', 'BTU')" />
|
<field name="test_mode" invisible="order_type not in ('FUL', 'BTU')" />
|
||||||
<field name="allowed_format_ids" invisible="1" />
|
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button
|
<button
|
||||||
|
Loading…
Reference in New Issue
Block a user