[IMP] add 'Mark files as Downloaded' menu entry to the EBICS configuration section

This commit is contained in:
Luc De Meyer
2026-04-14 21:50:38 +02:00
parent 4bf699a7c5
commit ed27aa25e4
4 changed files with 87 additions and 23 deletions

View File

@@ -120,7 +120,8 @@ class EbicsConfig(models.Model):
comodel_name="res.company",
relation="ebics_config_res_company_rel",
string="Companies",
readonly=True,
compute="_compute_company_ids",
store=True,
help="Companies sharing this EBICS contract.",
)
@@ -154,6 +155,11 @@ class EbicsConfig(models.Model):
)
)
@api.depends("journal_ids.company_id")
def _compute_company_ids(self):
for rec in self:
rec.company_ids = rec.journal_ids.mapped("company_id")
@api.ondelete(at_uninstall=False)
def _unlink_except_confirm(self):
if any(rec.state == "confirm" for rec in self):
@@ -161,27 +167,6 @@ class EbicsConfig(models.Model):
self.env._("You cannot remove active EBICS configurations.")
)
def write(self, vals):
"""
Due to the multi-company nature of the EBICS config we
need to adapt the company_ids in the write method.
"""
if "journal_ids" not in vals:
return super().write(vals)
for rec in self:
old_company_ids = rec.journal_ids.mapped("company_id").ids
super(EbicsConfig, rec).write(vals)
new_company_ids = rec.journal_ids.mapped("company_id").ids
updates = []
for cid in new_company_ids:
if cid in old_company_ids:
old_company_ids.remove(cid)
else:
updates += [(4, cid)]
updates += [(3, x) for x in old_company_ids]
super(EbicsConfig, rec).write({"company_ids": updates})
return True
def set_to_draft(self):
return self.write({"state": "draft"})