diff --git a/account_ebics/models/ebics_config.py b/account_ebics/models/ebics_config.py index 26fab66..7da7e4d 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,26 +155,10 @@ class EbicsConfig(models.Model): ) ) - 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) + @api.depends("journal_ids.company_id") + def _compute_company_ids(self): 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 + rec.company_ids = rec.journal_ids.mapped("company_id") def unlink(self): for ebics_config in self: diff --git a/account_ebics/views/menu.xml b/account_ebics/views/menu.xml index 3969fc4..5a92812 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 f3a1635..97c0d03 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 517023f..c7d838c 100644 --- a/account_ebics/wizards/ebics_xfer.xml +++ b/account_ebics/wizards/ebics_xfer.xml @@ -145,6 +145,75 @@ + + Mark EBICS files as Downloaded + ebics.xfer + 1 + +
+ + + + + + + + + + +
+
+
+
+
+ + + Mark files as Downloaded + ir.actions.act_window + ebics.xfer + form + new + {'ebics_download': 1, 'ebics_mark_as_downloaded': 1} + + + EBICS File Transfer - Download ir.actions.act_window