Add number of lines on bank statement form and tree views

This commit is contained in:
Alexis de Lattre
2022-09-20 14:23:03 +02:00
parent f23aa52b08
commit 9aa65925a9
2 changed files with 9 additions and 6 deletions

View File

@@ -10,11 +10,11 @@ class AccountBankStatement(models.Model):
_inherit = 'account.bank.statement' _inherit = 'account.bank.statement'
start_date = fields.Date( start_date = fields.Date(
compute='_compute_dates', string='Start Date', readonly=True, compute='_compute_dates', string='Start Date', store=True)
store=True)
end_date = fields.Date( end_date = fields.Date(
compute='_compute_dates', string='End Date', readonly=True, compute='_compute_dates', string='End Date', store=True)
store=True) line_count = fields.Integer(
compute='_compute_dates', string='# of Lines', store=True)
hide_bank_statement_balance = fields.Boolean( hide_bank_statement_balance = fields.Boolean(
related='journal_id.hide_bank_statement_balance', readonly=True) related='journal_id.hide_bank_statement_balance', readonly=True)
@@ -24,6 +24,7 @@ class AccountBankStatement(models.Model):
dates = [line.date for line in st.line_ids] dates = [line.date for line in st.line_ids]
st.start_date = dates and min(dates) or False st.start_date = dates and min(dates) or False
st.end_date = dates and max(dates) or False st.end_date = dates and max(dates) or False
st.line_count = len(dates)
def _check_balance_end_real_same_as_computed(self): def _check_balance_end_real_same_as_computed(self):
for stmt in self: for stmt in self:

View File

@@ -26,11 +26,12 @@
<button name="show_account_move" type="object" <button name="show_account_move" type="object"
title="View Journal Entry" icon="fa-arrow-right"/> title="View Journal Entry" icon="fa-arrow-right"/>
</xpath> </xpath>
<field name="date" position="after"> <xpath expr="//field[@name='balance_end_real']/.." position="after">
<field name="start_date"/> <field name="start_date"/>
<field name="end_date"/> <field name="end_date"/>
<field name="hide_bank_statement_balance" invisible="1"/> <field name="hide_bank_statement_balance" invisible="1"/>
</field> <field name="line_count"/>
</xpath>
<field name="date" position="attributes"> <field name="date" position="attributes">
<attribute name="invisible">1</attribute> <attribute name="invisible">1</attribute>
</field> </field>
@@ -74,6 +75,7 @@
<field name="journal_id" position="after"> <field name="journal_id" position="after">
<field name="start_date"/> <field name="start_date"/>
<field name="end_date"/> <field name="end_date"/>
<field name="line_count" optional="show"/>
</field> </field>
<field name="balance_start" position="attributes"> <field name="balance_start" position="attributes">
<attribute name="optional">show</attribute> <attribute name="optional">show</attribute>