From ed27aa25e4c7e4ba69e151c1bd63852fdc2140dc Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Tue, 14 Apr 2026 21:50:38 +0200 Subject: [PATCH] [IMP] add 'Mark files as Downloaded' menu entry to the EBICS configuration section --- account_ebics/models/ebics_config.py | 29 +++--------- account_ebics/views/menu.xml | 9 ++++ account_ebics/wizards/ebics_xfer.py | 3 +- account_ebics/wizards/ebics_xfer.xml | 69 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 23 deletions(-) diff --git a/account_ebics/models/ebics_config.py b/account_ebics/models/ebics_config.py index ff13f6a..463653a 100644 --- a/account_ebics/models/ebics_config.py +++ b/account_ebics/models/ebics_config.py @@ -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"}) diff --git a/account_ebics/views/menu.xml b/account_ebics/views/menu.xml index 54d738a..b77f1f8 100644 --- a/account_ebics/views/menu.xml +++ b/account_ebics/views/menu.xml @@ -80,4 +80,13 @@ groups="account_ebics.group_ebics_manager" sequence="30" /> + + diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index ee9a461..5847486 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -262,7 +262,8 @@ class EbicsXfer(models.TransientModel): } } data = client.download(df.order_type, params=params) - ebics_files += self._handle_download_data(data, df) + if not self.env.context.get("ebics_mark_as_downloaded"): + ebics_files += self._handle_download_data(data, df) success = True except EbicsFunctionalError: err_cnt += 1 diff --git a/account_ebics/wizards/ebics_xfer.xml b/account_ebics/wizards/ebics_xfer.xml index 60f5a5b..691dc41 100644 --- a/account_ebics/wizards/ebics_xfer.xml +++ b/account_ebics/wizards/ebics_xfer.xml @@ -164,4 +164,73 @@ {'ebics_upload': 1} + + + Mark EBICS files as Downloaded + ebics.xfer + + +
+ + + + + + + + + + +
+
+
+
+
+ + + Mark files as Downloaded + ir.actions.act_window + ebics.xfer + form + new + {'ebics_download': 1, 'ebics_mark_as_downloaded': 1} + +