book: hierarchie + test

book: Feld 'start_balance' entfernt
This commit is contained in:
Frederik Jaeckel 2022-09-15 23:49:54 +02:00
parent e10616e847
commit a2e7f192f8
16 changed files with 319 additions and 168 deletions

View file

@ -51,7 +51,8 @@ class Line(Workflow, ModelSQL, ModelView):
__name__ = 'cashbook.line'
cashbook = fields.Many2One(string='Cashbook', required=True, select=True,
model_name='cashbook.book', ondelete='CASCADE', readonly=True)
model_name='cashbook.book', ondelete='CASCADE', readonly=True,
domain=[('btype', '!=', None)])
date = fields.Date(string='Date', required=True, select=True,
states=STATES, depends=DEPENDS)
month = fields.Function(fields.Integer(string='Month', readonly=True),
@ -607,8 +608,8 @@ class Line(Workflow, ModelSQL, ModelView):
return 2
@fields.depends('id', 'date', 'cashbook', \
'_parent_cashbook.start_balance', '_parent_cashbook.id',\
'reconciliation', '_parent_reconciliation.start_amount',
'_parent_cashbook.id', 'reconciliation', \
'_parent_reconciliation.start_amount',\
'_parent_reconciliation.state')
def on_change_with_balance(self, name=None):
""" compute balance until current line, with current sort order,
@ -646,7 +647,7 @@ class Line(Workflow, ModelSQL, ModelView):
query = [
('cashbook.id', '=', self.cashbook.id),
]
balance = self.cashbook.start_balance
balance = Decimal('0.0')
# get existing reconciliation, starting before current line
# this will speed up calculation of by-line-balance