[MIG] account_ebics: Migration to 19.0

This commit is contained in:
Luc De Meyer
2026-03-01 23:30:15 +01:00
parent 051c68f785
commit 71835fae7b
23 changed files with 68 additions and 372 deletions

View File

@@ -126,7 +126,7 @@ class EbicsConfig(models.Model):
@api.model
def _default_ebics_keys(self):
return "/".join(["/etc/odoo/ebics_keys", self._cr.dbname])
return "/".join(["/etc/odoo/ebics_keys", self.env.cr.dbname])
@api.constrains("ebics_key_bitlength")
def _check_ebics_key_bitlength(self):
@@ -154,6 +154,13 @@ class EbicsConfig(models.Model):
)
)
@api.ondelete(at_uninstall=False)
def _unlink_except_confirm(self):
if any(rec.state == "confirm" for rec in self):
raise UserError(
self.env._("You cannot remove active EBICS configurations.")
)
def write(self, vals):
"""
Due to the multi-company nature of the EBICS config we
@@ -175,14 +182,6 @@ class EbicsConfig(models.Model):
super(EbicsConfig, rec).write({"company_ids": updates})
return True
def unlink(self):
for ebics_config in self:
if ebics_config.state == "active":
raise UserError(
self.env._("You cannot remove active EBICS configurations.")
)
return super().unlink()
def set_to_draft(self):
return self.write({"state": "draft"})
@@ -214,8 +213,8 @@ class EbicsConfig(models.Model):
if not os.path.exists(dirname):
raise UserError(
self.env._(
"EBICS Keys Root Directory %s is not available."
"\nPlease contact your system administrator."
"EBICS Keys Root Directory %(dir)s is not available."
"\nPlease contact your system administrator.",
dir=dirname,
)
% dirname
)