Skip to content

Commit

Permalink
[IMP] make the statements views editable=top by default
Browse files Browse the repository at this point in the history
And add an icon to allow users to navigate to the statement lines.
Currently it's not possible to open the statement form view. When editing the
view an error occurs, related with the recomputation of running balances.
  • Loading branch information
JordiBForgeFlow committed Sep 23, 2024
1 parent 94b4cda commit 7014329
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions account_statement_base/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import account_journal_dashboard
from . import account_bank_statement
15 changes: 15 additions & 0 deletions account_statement_base/models/account_bank_statement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from odoo import models


class AccountBankStatement(models.Model):
_inherit = "account.bank.statement"

def action_open_statement_lines(self):
self.ensure_one()

Check warning on line 8 in account_statement_base/models/account_bank_statement.py

View check run for this annotation

Codecov / codecov/patch

account_statement_base/models/account_bank_statement.py#L8

Added line #L8 was not covered by tests
if not self:
return {}
action = self.env["ir.actions.act_window"]._for_xml_id(

Check warning on line 11 in account_statement_base/models/account_bank_statement.py

View check run for this annotation

Codecov / codecov/patch

account_statement_base/models/account_bank_statement.py#L10-L11

Added lines #L10 - L11 were not covered by tests
"account_statement_base.account_bank_statement_line_action"
)
action.update({"domain": [("statement_id", "=", self.id)]})
return action

Check warning on line 15 in account_statement_base/models/account_bank_statement.py

View check run for this annotation

Codecov / codecov/patch

account_statement_base/models/account_bank_statement.py#L14-L15

Added lines #L14 - L15 were not covered by tests
19 changes: 19 additions & 0 deletions account_statement_base/views/account_bank_statement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,23 @@
<field name="view_mode">tree,form,pivot,graph</field>
</record>

<record id="view_bank_statement_tree" model="ir.ui.view">
<field name="name">account.bank.statement.tree</field>
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_tree" />
<field name="arch" type="xml">
<tree position="attributes">
<attribute name="editable">top</attribute>
</tree>
<field name="balance_end_real" position="after">
<button
name="action_open_statement_lines"
type="object"
title="Open Statement Lines"
icon="fa-folder-open-o"
/>
</field>
</field>
</record>

</odoo>

0 comments on commit 7014329

Please sign in to comment.