Skip to content

Commit

Permalink
[IMP] account_statement_base: add possibility to navigate from statem…
Browse files Browse the repository at this point in the history
…ent lines to the

associated journal entry through a button. Adds also the journal entry number
as an optional field
  • Loading branch information
JordiBForgeFlow committed Aug 9, 2024
1 parent ce99a73 commit ce3600d
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions account_statement_base/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ Contributors
* Carlos Dauden
* Sergio Teruel

* `ForgeFlow <https://www.forgeflow.com>`_:

* Jordi Ballester

Maintainers
~~~~~~~~~~~

Expand Down
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_line
21 changes: 21 additions & 0 deletions account_statement_base/models/account_bank_statement_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 ForgeFlow
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class AccountBankStatementLine(models.Model):

_inherit = "account.bank.statement.line"

def action_open_journal_entry(self):
self.ensure_one()

Check warning on line 12 in account_statement_base/models/account_bank_statement_line.py

View check run for this annotation

Codecov / codecov/patch

account_statement_base/models/account_bank_statement_line.py#L12

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

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

View check run for this annotation

Codecov / codecov/patch

account_statement_base/models/account_bank_statement_line.py#L14-L15

Added lines #L14 - L15 were not covered by tests
"account.action_move_line_form"
)
res = self.env.ref("account.view_move_form", False)
result["views"] = [(res and res.id or False, "form")]
result["res_id"] = self.move_id.id
return result

Check warning on line 21 in account_statement_base/models/account_bank_statement_line.py

View check run for this annotation

Codecov / codecov/patch

account_statement_base/models/account_bank_statement_line.py#L18-L21

Added lines #L18 - L21 were not covered by tests
4 changes: 4 additions & 0 deletions account_statement_base/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@

* Carlos Dauden
* Sergio Teruel

* `ForgeFlow <https://www.forgeflow.com>`_:

* Jordi Ballester
4 changes: 4 additions & 0 deletions account_statement_base/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<li>Sergio Teruel</li>
</ul>
</li>
<li><a class="reference external" href="https://www.forgeflow.com">ForgeFlow</a>:<ul>
<li>Jordi Ballester</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
7 changes: 7 additions & 0 deletions account_statement_base/views/account_bank_statement_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<tree editable="top" multi_edit="1" decoration-muted="is_reconciled">
<field name="sequence" />
<field name="date" attrs="{'readonly': [('is_reconciled', '=', True)]}" />
<field name="move_id" optional="hide" />
<field
name="payment_ref"
attrs="{'readonly': [('is_reconciled', '=', True)]}"
Expand Down Expand Up @@ -112,6 +113,12 @@
icon="fa-undo"
attrs="{'invisible': [('is_reconciled', '=', False)]}"
/>
<button
name="action_open_journal_entry"
type="object"
title="Open Journal Entry"
icon="fa-folder-open-o"
/>
<field name="company_id" invisible="1" />
<field name="is_reconciled" invisible="1" />
<field name="currency_id" invisible="1" />
Expand Down

0 comments on commit ce3600d

Please sign in to comment.