mirror of
https://github.com/brain-tec/account_ebics.git
synced 2024-11-23 12:42:04 +00:00
[IMP] account_ebics: pre-commit auto fixes
This commit is contained in:
parent
69aa471c17
commit
08482045d8
@ -6,7 +6,7 @@
|
||||
"version": "16.0.1.9.0",
|
||||
"license": "LGPL-3",
|
||||
"author": "Noviat",
|
||||
"website": "https://www.noviat.com/",
|
||||
"website": "https://www.noviat.com",
|
||||
"category": "Accounting & Finance",
|
||||
"depends": ["account"],
|
||||
"data": [
|
||||
|
@ -8,7 +8,6 @@ from openupgradelib import openupgrade # pylint: disable=W7936
|
||||
|
||||
@openupgrade.migrate()
|
||||
def migrate(env, version):
|
||||
|
||||
_ebics_config_upgrade(env, version)
|
||||
_noupdate_changes(env, version)
|
||||
|
||||
|
@ -27,9 +27,7 @@ def _update_file_format(cr, ff):
|
||||
"""
|
||||
SELECT res_id FROM ir_model_data
|
||||
WHERE module='account_ebics' AND name='{}'
|
||||
""".format(
|
||||
ff["xml_id_name"]
|
||||
)
|
||||
""".format(ff["xml_id_name"])
|
||||
)
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
|
@ -57,9 +57,7 @@ def _update_file_format(cr, ff):
|
||||
"""
|
||||
SELECT id, res_id FROM ir_model_data
|
||||
WHERE module='account_ebics' AND name='{}'
|
||||
""".format(
|
||||
ff["old_xml_id_name"]
|
||||
)
|
||||
""".format(ff["old_xml_id_name"])
|
||||
)
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
@ -67,15 +65,11 @@ def _update_file_format(cr, ff):
|
||||
UPDATE ir_model_data
|
||||
SET name='{new_xml_id_name}'
|
||||
WHERE id={xml_id};
|
||||
""".format(
|
||||
new_xml_id_name=ff["new_xml_id_name"], xml_id=res[0]
|
||||
)
|
||||
""".format(new_xml_id_name=ff["new_xml_id_name"], xml_id=res[0])
|
||||
if ff.get("new_name"):
|
||||
query += """
|
||||
UPDATE ebics_file_format
|
||||
SET name='{new_name}'
|
||||
WHERE id={ff_id};
|
||||
""".format(
|
||||
new_name=ff["new_name"], ff_id=res[1]
|
||||
)
|
||||
""".format(new_name=ff["new_name"], ff_id=res[1])
|
||||
cr.execute(query) # pylint: disable=E8103
|
||||
|
@ -549,7 +549,7 @@ class EbicsFile(models.Model):
|
||||
"054": "Ntfctn",
|
||||
}
|
||||
camt_tag = variant_tags[camt_variant]
|
||||
stmts = root[0].findall("ns:{}".format(camt_tag), ns)
|
||||
stmts = root[0].findall(f"ns:{camt_tag}", ns)
|
||||
for i, stmt in enumerate(stmts):
|
||||
acc_number = sanitize_account_number(
|
||||
stmt.xpath(
|
||||
@ -572,7 +572,7 @@ class EbicsFile(models.Model):
|
||||
|
||||
root_new = deepcopy(root)
|
||||
entries = False
|
||||
for j, el in enumerate(root_new[0].findall("ns:{}".format(camt_tag), ns)):
|
||||
for j, el in enumerate(root_new[0].findall(f"ns:{camt_tag}", ns)):
|
||||
if j != i:
|
||||
el.getparent().remove(el)
|
||||
else:
|
||||
|
@ -437,7 +437,7 @@ class EbicsUserID(models.Model):
|
||||
err_msg = _("EBICS version mismatch.") + "\n"
|
||||
err_msg += _("Versions supported by your bank:")
|
||||
for k in supported_versions:
|
||||
err_msg += "\n{}: {} ".format(k, supported_versions[k])
|
||||
err_msg += f"\n{k}: {supported_versions[k]} "
|
||||
raise UserError(err_msg)
|
||||
if ebics_version == "H003":
|
||||
bank._order_number = self.ebics_config_id._get_order_number()
|
||||
@ -464,13 +464,13 @@ class EbicsUserID(models.Model):
|
||||
e = exc_info()
|
||||
error = _("EBICS Functional Error:")
|
||||
error += "\n"
|
||||
error += "{} (code: {})".format(e[1].message, e[1].code)
|
||||
error += f"{e[1].message} (code: {e[1].code})"
|
||||
raise UserError(error) from err
|
||||
except EbicsTechnicalError as err:
|
||||
e = exc_info()
|
||||
error = _("EBICS Technical Error:")
|
||||
error += "\n"
|
||||
error += "{} (code: {})".format(e[1].message, e[1].code)
|
||||
error += f"{e[1].message} (code: {e[1].code})"
|
||||
raise UserError(error) from err
|
||||
|
||||
# Send the public authentication and encryption keys to the bank.
|
||||
@ -549,7 +549,7 @@ class EbicsUserID(models.Model):
|
||||
e = exc_info()
|
||||
error = _("EBICS Functional Error:")
|
||||
error += "\n"
|
||||
error += "{} (code: {})".format(e[1].message, e[1].code)
|
||||
error += f"{e[1].message} (code: {e[1].code})"
|
||||
raise UserError(error) from err
|
||||
except Exception as err:
|
||||
exctype, value = exc_info()[:2]
|
||||
|
3
account_ebics/pyproject.toml
Normal file
3
account_ebics/pyproject.toml
Normal file
@ -0,0 +1,3 @@
|
||||
[build-system]
|
||||
requires = ["whool"]
|
||||
build-backend = "whool.buildapi"
|
@ -259,7 +259,7 @@ class EbicsXfer(models.TransientModel):
|
||||
order_type=df.order_type,
|
||||
)
|
||||
self.note += "\n"
|
||||
self.note += "{} (code: {})".format(e[1].message, e[1].code)
|
||||
self.note += f"{e[1].message} (code: {e[1].code})"
|
||||
except EbicsTechnicalError:
|
||||
err_cnt += 1
|
||||
e = exc_info()
|
||||
@ -271,7 +271,7 @@ class EbicsXfer(models.TransientModel):
|
||||
order_type=df.order_type,
|
||||
)
|
||||
self.note += "\n"
|
||||
self.note += "{} (code: {})".format(e[1].message, e[1].code)
|
||||
self.note += f"{e[1].message} (code: {e[1].code})"
|
||||
except EbicsVerificationError:
|
||||
err_cnt += 1
|
||||
self.note += "\n"
|
||||
@ -341,7 +341,7 @@ class EbicsXfer(models.TransientModel):
|
||||
self.ensure_one()
|
||||
module = __name__.split("addons.")[1].split(".")[0]
|
||||
act = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"{}.ebics_file_action_download".format(module)
|
||||
f"{module}.ebics_file_action_download"
|
||||
)
|
||||
act["domain"] = [("id", "in", self._context["ebics_file_ids"])]
|
||||
return act
|
||||
@ -416,13 +416,13 @@ class EbicsXfer(models.TransientModel):
|
||||
self.note += "\n"
|
||||
self.note += _("EBICS Functional Error:")
|
||||
self.note += "\n"
|
||||
self.note += "{} (code: {})".format(e[1].message, e[1].code)
|
||||
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 += "\n"
|
||||
self.note += "{} (code: {})".format(e[1].message, e[1].code)
|
||||
self.note += f"{e[1].message} (code: {e[1].code})"
|
||||
except EbicsVerificationError:
|
||||
self.note += "\n"
|
||||
self.note += _("EBICS Verification Error:")
|
||||
|
Loading…
Reference in New Issue
Block a user