mirror of
https://github.com/brain-tec/account_ebics.git
synced 2026-04-26 07:36:51 +00:00
[IMP] add 'Mark files as Downloaded' menu entry to the EBICS configuration section
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -82,4 +82,13 @@
|
||||
sequence="30"
|
||||
/>
|
||||
|
||||
<menuitem
|
||||
id="ebics_xfer_menu_mark_as_downloaded"
|
||||
name="Mark files as Downloaded"
|
||||
parent="ebics_menu"
|
||||
action="account_ebics.ebics_xfer_action_mark_as_downloaded"
|
||||
groups="account_ebics.group_ebics_manager"
|
||||
sequence="40"
|
||||
/>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -263,6 +263,7 @@ class EbicsXfer(models.TransientModel):
|
||||
}
|
||||
}
|
||||
data = client.download(df.order_type, params=params)
|
||||
if not self.env.context.get("ebics_mark_as_downloaded"):
|
||||
ebics_files += self._handle_download_data(data, df)
|
||||
success = True
|
||||
except EbicsFunctionalError:
|
||||
|
||||
@@ -169,4 +169,73 @@
|
||||
<field name="view_id" ref="ebics_xfer_view_form_upload" />
|
||||
</record>
|
||||
|
||||
<record id="ebics_xfer_view_form_mark_as_downloaded" model="ir.ui.view">
|
||||
<field name="name">Mark EBICS files as Downloaded</field>
|
||||
<field name="model">ebics.xfer</field>
|
||||
<field name="priority">1</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="EBICS Mark as Downloaded">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
The EBICS Files (Bank Statements) selected via this screen will not become available in Odoo as EBICS files but will be marked by your bank as downloaded.
|
||||
<br />
|
||||
As a consequence, these Bank Statements will not be retrieved by the next 'EBICS Batch Import' scheduled action.
|
||||
</div>
|
||||
<group>
|
||||
<separator string="Select your bank :" colspan="2" />
|
||||
<field
|
||||
name="ebics_config_id"
|
||||
required="1"
|
||||
options="{'no_create': True, 'no_open': True}"
|
||||
/>
|
||||
<field
|
||||
name="ebics_userid_id"
|
||||
domain="[('ebics_config_id', '=', ebics_config_id), ('user_ids.id', '=', uid), ('transaction_rights', 'in', ['both', 'down'])]"
|
||||
required="1"
|
||||
options="{'no_create': True, 'no_open': True}"
|
||||
/>
|
||||
<field
|
||||
name="ebics_passphrase"
|
||||
password="True"
|
||||
invisible="ebics_passphrase_store"
|
||||
required="not ebics_passphrase_store"
|
||||
/>
|
||||
<field name="date_from" required="1" />
|
||||
<field name="date_to" required="1" />
|
||||
<field
|
||||
name="format_id"
|
||||
required="1"
|
||||
domain="[('type', '=', 'down'), ('id', 'in', allowed_format_ids)]"
|
||||
/>
|
||||
</group>
|
||||
<footer>
|
||||
<button
|
||||
name="ebics_download"
|
||||
string="Mark as Downloaded"
|
||||
type="object"
|
||||
class="btn-primary"
|
||||
data-hotkey="q"
|
||||
/>
|
||||
<button
|
||||
string="Cancel"
|
||||
class="btn-secondary"
|
||||
special="cancel"
|
||||
data-hotkey="z"
|
||||
/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="ebics_xfer_action_mark_as_downloaded" model="ir.actions.act_window">
|
||||
<field name="name">Mark files as Downloaded</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">ebics.xfer</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
<field
|
||||
name="context"
|
||||
>{'ebics_download': 1, 'ebics_mark_as_downloaded': 1}</field>
|
||||
<field name="view_id" ref="ebics_xfer_view_form_mark_as_downloaded" />
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user