hide the reconciled bank lines

This commit is contained in:
Suherdy Yacob 2025-10-27 08:53:48 +07:00
parent 302f15fa98
commit 147419cf5a
3 changed files with 12 additions and 4 deletions

View File

@ -5,6 +5,14 @@ from odoo.exceptions import UserError
class AccountBankStatementLine(models.Model):
_inherit = 'account.bank.statement.line'
is_reconciled = fields.Boolean(string='Is Reconciled', compute='_compute_is_reconciled', store=True)
@api.depends('move_id')
def _compute_is_reconciled(self):
"""Compute whether the bank line has been reconciled"""
for line in self:
line.is_reconciled = bool(line.move_id and 'Reconciliation:' in line.move_id.name)
def action_reconcile_selected_lines(self):
"""Open the reconciliation wizard for selected lines"""
# Get the selected records from the context

View File

@ -37,14 +37,14 @@
<field name="name">account.bank.statement.line.tree</field>
<field name="model">account.bank.statement.line</field>
<field name="arch" type="xml">
<tree string="Bank Statement Lines" create="0" delete="0" decoration-danger="amount &lt; 0" decoration-muted="move_id and 'Reconciliation:' in move_id.name">
<tree string="Bank Statement Lines" create="0" delete="0" decoration-danger="amount &lt; 0">
<field name="date"/>
<field name="name"/>
<field name="partner_id"/>
<field name="amount"/>
<field name="journal_id"/>
<field name="statement_id"/>
<field name="move_id"/>
<field name="move_id" invisible="1"/>
</tree>
</field>
</record>
@ -60,7 +60,6 @@
</header>
<sheet>
<group>
<group>
<field name="date"/>
<field name="name"/>
<field name="ref"/>
@ -70,7 +69,6 @@
<field name="partner_id"/>
<field name="journal_id" readonly="1"/>
</group>
</group>
<group>
<field name="statement_id"/>
<field name="move_id"/>
@ -93,6 +91,8 @@
<field name="date"/>
<filter name="positive_amount" string="Income" domain="[('amount', '&gt;', 0)]"/>
<filter name="negative_amount" string="Expense" domain="[('amount', '&lt;', 0)]"/>
<filter name="hide_reconciled" string="Hide Reconciled" domain="[('is_reconciled', '=', False)]" help="Hide lines that have been reconciled"/>
<filter name="show_all" string="Show All" domain="[]" help="Show all lines including reconciled"/>
<group expand="0" string="Group By">
<filter name="group_by_journal" string="Journal" context="{'group_by': 'journal_id'}"/>
<filter name="group_by_date" string="Date" context="{'group_by': 'date'}"/>