[IMP] account_reconcile_oca: reconcile lines from statement
UX: override the statement lines button action so we can reconcile directly from the statement itself. TT51834pull/757/head
parent
17a9847892
commit
a3c7914410
|
@ -1,6 +1,7 @@
|
|||
# Copyright 2024 Dixmit
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
from odoo import models
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
|
||||
|
||||
class AccountBankStatement(models.Model):
|
||||
|
@ -13,3 +14,17 @@ class AccountBankStatement(models.Model):
|
|||
)
|
||||
action["res_id"] = self.id
|
||||
return action
|
||||
|
||||
def action_open_statement_lines(self):
|
||||
"""Open in reconciling view directly"""
|
||||
self.ensure_one()
|
||||
if not self:
|
||||
return {}
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"account_reconcile_oca.action_bank_statement_line_reconcile"
|
||||
)
|
||||
action["domain"] = [("statement_id", "=", self.id)]
|
||||
action["context"] = safe_eval(
|
||||
action["context"], locals_dict={"active_id": self._context.get("active_id")}
|
||||
)
|
||||
return action
|
||||
|
|
|
@ -31,7 +31,22 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_bank_statement_form" model="ir.ui.view">
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_statement_base.view_bank_statement_form"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath
|
||||
expr="//button[contains(@context,'search_default_statement_id')]"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="type">object</attribute>
|
||||
<attribute name="name">action_open_statement_lines</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="account_bank_statement_action_edit" model="ir.actions.act_window">
|
||||
<field name="name">Edit Bank Statement</field>
|
||||
<field name="res_model">account.bank.statement</field>
|
||||
|
|
Loading…
Reference in New Issue