mirror of
https://github.com/brain-tec/account_ebics.git
synced 2025-08-13 22:25:35 +00:00
[MIG] account_ebics: Migration to 18.0
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
import pprint
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class EbicsAdminOrder(models.TransientModel):
|
||||
@@ -30,7 +30,7 @@ class EbicsAdminOrder(models.TransientModel):
|
||||
client = self._setup_client()
|
||||
if not client:
|
||||
self.note += (
|
||||
_("EBICS client setup failed for connection '%s'")
|
||||
self.env._("EBICS client setup failed for connection '%s'")
|
||||
% self.ebics_config_id.name
|
||||
)
|
||||
else:
|
||||
@@ -40,7 +40,7 @@ class EbicsAdminOrder(models.TransientModel):
|
||||
module = __name__.split("addons.")[1].split(".")[0]
|
||||
result_view = self.env.ref("%s.ebics_admin_order_view_form_result" % module)
|
||||
return {
|
||||
"name": _("EBICS Administrative Order result"),
|
||||
"name": self.env._("EBICS Administrative Order result"),
|
||||
"res_id": self.id,
|
||||
"view_type": "form",
|
||||
"view_mode": "form",
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
from odoo import _, fields, models
|
||||
from odoo import fields, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -50,21 +50,23 @@ class EbicsChangePassphrase(models.TransientModel):
|
||||
and self.old_pass
|
||||
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:
|
||||
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:
|
||||
raise UserError(_("New passphrase equal to old passphrase."))
|
||||
raise UserError(self.env._("New passphrase equal to old passphrase."))
|
||||
if (
|
||||
self.new_sig_pass
|
||||
and self.old_sig_pass
|
||||
and self.new_sig_pass == self.old_sig_pass
|
||||
):
|
||||
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:
|
||||
raise UserError(_("New signature passphrase verification error."))
|
||||
raise UserError(self.env._("New signature passphrase verification error."))
|
||||
passphrase = (
|
||||
self.ebics_userid_id.ebics_passphrase_store
|
||||
and self.ebics_userid_id.ebics_passphrase
|
||||
@@ -105,7 +107,7 @@ class EbicsChangePassphrase(models.TransientModel):
|
||||
"%s.ebics_change_passphrase_view_form_result" % module
|
||||
)
|
||||
return {
|
||||
"name": _("EBICS Keys Change Passphrase"),
|
||||
"name": self.env._("EBICS Keys Change Passphrase"),
|
||||
"res_id": self.id,
|
||||
"view_type": "form",
|
||||
"view_mode": "form",
|
||||
|
@@ -18,9 +18,6 @@
|
||||
<field name="new_sig_pass" password="True" />
|
||||
<field name="new_sig_pass_check" password="True" />
|
||||
</group>
|
||||
<group name="invisible" invisible="1">
|
||||
<field name="ebics_sig_passphrase_invisible" />
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button
|
||||
|
@@ -6,7 +6,7 @@ import logging
|
||||
from sys import exc_info
|
||||
from traceback import format_exception
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo import api, fields, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -203,7 +203,7 @@ class EbicsXfer(models.TransientModel):
|
||||
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"),
|
||||
"name": self.env._("EBICS file transfer result"),
|
||||
"res_id": self.id,
|
||||
"view_type": "form",
|
||||
"view_mode": "form",
|
||||
@@ -223,7 +223,7 @@ class EbicsXfer(models.TransientModel):
|
||||
if not client:
|
||||
err_cnt += 1
|
||||
self.note += (
|
||||
_("EBICS client setup failed for connection '%s'")
|
||||
self.env._("EBICS client setup failed for connection '%s'")
|
||||
% self.ebics_config_id.name
|
||||
)
|
||||
else:
|
||||
@@ -269,7 +269,7 @@ class EbicsXfer(models.TransientModel):
|
||||
err_cnt += 1
|
||||
e = exc_info()
|
||||
self.note += "\n"
|
||||
self.note += _(
|
||||
self.note += self.env._(
|
||||
"EBICS Functional Error during download of "
|
||||
"File Format %(name)s (%(order_type)s):",
|
||||
name=df.name or df.description,
|
||||
@@ -281,7 +281,7 @@ class EbicsXfer(models.TransientModel):
|
||||
err_cnt += 1
|
||||
e = exc_info()
|
||||
self.note += "\n"
|
||||
self.note += _(
|
||||
self.note += self.env._(
|
||||
"EBICS Technical Error during download of "
|
||||
"File Format %(name)s (%(order_type)s):",
|
||||
name=df.name or df.description,
|
||||
@@ -292,18 +292,18 @@ class EbicsXfer(models.TransientModel):
|
||||
except EbicsVerificationError:
|
||||
err_cnt += 1
|
||||
self.note += "\n"
|
||||
self.note += _(
|
||||
self.note += self.env._(
|
||||
"EBICS Verification Error during download of "
|
||||
"File Format %(name)s (%(order_type)s):",
|
||||
name=df.name or df.description,
|
||||
order_type=df.order_type,
|
||||
)
|
||||
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:
|
||||
err_cnt += 1
|
||||
self.note += "\n"
|
||||
self.note += _(
|
||||
self.note += self.env._(
|
||||
"Error detected during download of "
|
||||
"File Format %(name)s (%(order_type)s):",
|
||||
name=df.name or df.description,
|
||||
@@ -314,7 +314,7 @@ class EbicsXfer(models.TransientModel):
|
||||
except Exception:
|
||||
err_cnt += 1
|
||||
self.note += "\n"
|
||||
self.note += _(
|
||||
self.note += self.env._(
|
||||
"Unknown Error during download of "
|
||||
"File Format %(name)s (%(order_type)s):",
|
||||
name=df.name or df.description,
|
||||
@@ -334,7 +334,9 @@ class EbicsXfer(models.TransientModel):
|
||||
self.note += "\n"
|
||||
for f in ebics_files:
|
||||
self.note += (
|
||||
_("EBICS File '%s' is available for further processing.")
|
||||
self.env._(
|
||||
"EBICS File '%s' is available for further processing."
|
||||
)
|
||||
% f.name
|
||||
)
|
||||
self.note += "\n"
|
||||
@@ -343,7 +345,7 @@ class EbicsXfer(models.TransientModel):
|
||||
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"),
|
||||
"name": self.env._("EBICS file transfer result"),
|
||||
"res_id": self.id,
|
||||
"view_type": "form",
|
||||
"view_mode": "form",
|
||||
@@ -403,11 +405,14 @@ class EbicsXfer(models.TransientModel):
|
||||
if OrderID:
|
||||
self.note += "\n"
|
||||
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"):
|
||||
ef_note += "\n" + _("Origin: %s") % self._context["origin"]
|
||||
ef_note += (
|
||||
"\n" + self.env._("Origin: %s") % self._context["origin"]
|
||||
)
|
||||
suffix = self.format_id.suffix
|
||||
fn = self.upload_fname
|
||||
if suffix and not fn.endswith(suffix):
|
||||
@@ -431,23 +436,23 @@ class EbicsXfer(models.TransientModel):
|
||||
except EbicsFunctionalError:
|
||||
e = exc_info()
|
||||
self.note += "\n"
|
||||
self.note += _("EBICS Functional Error:")
|
||||
self.note += self.env._("EBICS Functional Error:")
|
||||
self.note += "\n"
|
||||
self.note += f"{e[1].message} (code: {e[1].code})"
|
||||
except EbicsTechnicalError:
|
||||
e = exc_info()
|
||||
self.note += "\n"
|
||||
self.note += _("EBICS Technical Error:")
|
||||
self.note += self.env._("EBICS Technical Error:")
|
||||
self.note += "\n"
|
||||
self.note += f"{e[1].message} (code: {e[1].code})"
|
||||
except EbicsVerificationError:
|
||||
self.note += "\n"
|
||||
self.note += _("EBICS Verification Error:")
|
||||
self.note += self.env._("EBICS Verification Error:")
|
||||
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:
|
||||
self.note += "\n"
|
||||
self.note += _("Unknown Error")
|
||||
self.note += self.env._("Unknown Error")
|
||||
tb = "".join(format_exception(*exc_info()))
|
||||
self.note += "\n%s" % tb
|
||||
|
||||
@@ -478,7 +483,7 @@ class EbicsXfer(models.TransientModel):
|
||||
try:
|
||||
keyring = EbicsKeyRing(**keyring_params)
|
||||
except (RuntimeError, ValueError) as err:
|
||||
error = _("Error while accessing the EBICS Keys:")
|
||||
error = self.env._("Error while accessing the EBICS Keys:")
|
||||
error += "\n"
|
||||
error += err.args[0]
|
||||
raise UserError(error) from err
|
||||
@@ -507,13 +512,15 @@ class EbicsXfer(models.TransientModel):
|
||||
try:
|
||||
user = EbicsUser(**user_params)
|
||||
except ValueError as err:
|
||||
error = _("Error while accessing the EBICS UserID:")
|
||||
error = self.env._("Error while accessing the EBICS UserID:")
|
||||
error += "\n"
|
||||
err_str = err.args[0]
|
||||
error += err.args[0]
|
||||
if err_str == "unknown key format":
|
||||
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
|
||||
# manual_approval replaced by transport_only class param in fintech 7.4
|
||||
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)
|
||||
except Exception:
|
||||
self.note += "\n"
|
||||
self.note += _("Unknown Error")
|
||||
self.note += self.env._("Unknown Error")
|
||||
tb = "".join(format_exception(*exc_info()))
|
||||
self.note += "\n%s" % tb
|
||||
client = False
|
||||
@@ -590,7 +597,7 @@ class EbicsXfer(models.TransientModel):
|
||||
dups = self._check_duplicate_ebics_file(fn, file_format)
|
||||
if dups:
|
||||
raise UserError(
|
||||
_(
|
||||
self.env._(
|
||||
"EBICS File with name '%s' has already been downloaded."
|
||||
"\nPlease check this file and rename in case there is "
|
||||
"no risk on duplicate transactions."
|
||||
|
@@ -26,7 +26,6 @@
|
||||
invisible="ebics_passphrase_store"
|
||||
required="not ebics_passphrase_store"
|
||||
/>
|
||||
<field name="ebics_passphrase_store" invisible="1" />
|
||||
<field name="date_from" />
|
||||
<field name="date_to" />
|
||||
<field
|
||||
@@ -34,7 +33,6 @@
|
||||
domain="[('type', '=', 'down'), ('id', 'in', allowed_format_ids)]"
|
||||
/>
|
||||
<field name="order_type" />
|
||||
<field name="allowed_format_ids" invisible="1" />
|
||||
</group>
|
||||
<footer>
|
||||
<button
|
||||
@@ -85,13 +83,10 @@
|
||||
password="True"
|
||||
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" />
|
||||
<field name="upload_data" filename="upload_fname" required="1" />
|
||||
<field name="upload_fname" invisible="1" />
|
||||
<field name="upload_fname_dummy" string="Upload Filename" />
|
||||
<field name="upload_format_ids" invisible="1" />
|
||||
<field
|
||||
name="format_id"
|
||||
required="1"
|
||||
@@ -100,7 +95,6 @@
|
||||
/>
|
||||
<field name="order_type" />
|
||||
<field name="test_mode" invisible="order_type not in ('FUL', 'BTU')" />
|
||||
<field name="allowed_format_ids" invisible="1" />
|
||||
</group>
|
||||
<footer>
|
||||
<button
|
||||
|
Reference in New Issue
Block a user