account_usability_akretion: change behavior of running balance in dashboard

Use accounting balance like in v14 and not bank statement start/end balance
This commit is contained in:
Alexis de Lattre
2025-02-19 10:43:02 +00:00
parent 0aa31956e0
commit 66f617e797
2 changed files with 12 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ class AccountJournal(models.Model):
_inherit = 'account.journal'
hide_bank_statement_balance = fields.Boolean(
string='Hide and Disable Bank Statement Balance',
string='Hide and Disable Bank Statement Balance', default=True,
help="When this option is enabled, the start and end balance is "
"not displayed on the bank statement form view, and the check of "
"the end balance vs the real end balance is disabled. When you enable "
@@ -55,3 +55,12 @@ class AccountJournal(models.Model):
'search_default_posted': True,
}
return action
# field used in journal dashboard for bank journals
# compute account_balance like in v14, using accounting and
# NOT bank statement balance_start/balance_end
def _compute_current_statement_balance(self):
query_result = self._get_journal_dashboard_bank_running_balance()
for journal in self:
journal.has_statement_lines = query_result.get(journal.id)[0]
journal.current_statement_balance = journal._get_journal_bank_account_balance()[0]

View File

@@ -36,7 +36,6 @@
</field>
</record>
<!-- TODO
<record id="account_journal_dashboard_kanban_view" model="ir.ui.view">
<field name="name">usability.account.journal.dashboard</field>
<field name="model">account.journal</field>
@@ -48,12 +47,12 @@
<xpath expr="//div[@name='latest_statement']/.." position="attributes">
<attribute name="t-if">dashboard.has_at_least_one_statement and dashboard.account_balance != dashboard.last_balance and !record.hide_bank_statement_balance.raw_value</attribute>
</xpath>
<!--
<t t-esc="dashboard.outstanding_pay_account_balance" position="replace">
<a name="open_outstanding_payments" type="object" title="Outstanding Payments/Receipts"><t t-esc="dashboard.outstanding_pay_account_balance"/></a>
</t>
</t> -->
</field>
</record>
-->
<record id="view_account_journal_search" model="ir.ui.view">
<field name="name">usability.account.journal.search</field>