spitbuchung begonnen

This commit is contained in:
Frederik Jaeckel 2022-08-24 17:12:32 +02:00
parent 9e64c49dc0
commit bdbc9dc27f
10 changed files with 382 additions and 7 deletions

23
line.py
View file

@ -31,6 +31,8 @@ sel_linetype = [
sel_bookingtype = [
('in', 'Revenue'),
('out', 'Expense'),
('spin', 'Revenue Splitbooking'),
('spout', 'Expense Splitbooking'),
('mvin', 'Transfer from'),
('mvout', 'Transfer to'),
]
@ -102,7 +104,7 @@ class Line(Workflow, ModelSQL, ModelView):
ondelete='RESTRICT',
states={
'readonly': STATES['readonly'],
'invisible': ~Eval('bookingtype', '').in_(['in', 'out']),
'invisible': ~Eval('bookingtype', '').in_(['in', 'out', 'spin', 'spout']),
}, depends=DEPENDS+['bookingtype'])
payee = fields.Function(fields.Reference(string='Payee', readonly=True,
selection=sel_payee), 'on_change_with_payee', searcher='search_payee')
@ -113,11 +115,18 @@ class Line(Workflow, ModelSQL, ModelView):
'invisible': ~Bool(Eval('reference')),
}, model_name='cashbook.line', ondelete='CASCADE',
help='The current row was created by and is controlled by the reference row.')
references = fields.One2Many(string='References', model_name='cashbook.line',
references = fields.One2Many(string='References',
model_name='cashbook.line',
help='The rows are created and managed by the current record.',
states={
'invisible': ~Bool(Eval('references')),
}, field='reference', readonly=True)
splitlines = fields.One2Many(string='Split booking lines',
model_name='cashbook.split',
help='The rows are created and managed by the current record.',
states={
'invisible': ~Bool(Eval('splitlines')),
}, field='line', readonly=True)
reconciliation = fields.Many2One(string='Reconciliation', readonly=True,
model_name='cashbook.recon', ondelete='SET NULL',
@ -398,7 +407,7 @@ class Line(Workflow, ModelSQL, ModelView):
""" get party or cashbook
"""
if self.bookingtype:
if self.bookingtype in ['in', 'out']:
if self.bookingtype in ['in', 'out', 'spin', 'spout']:
if self.party:
return 'party.party,%d' % self.party.id
elif self.bookingtype in ['mvin', 'mvout']:
@ -488,8 +497,8 @@ class Line(Workflow, ModelSQL, ModelView):
""" clear category if not valid type
"""
types = {
'in': ['in', 'mvin'],
'out': ['out', 'mvout'],
'in': ['in', 'mvin', 'spin'],
'out': ['out', 'mvout', 'spout'],
}
if self.bookingtype:
@ -570,12 +579,12 @@ class Line(Workflow, ModelSQL, ModelView):
if type_:
if amount is not None:
if type_ in ['in', 'mvin']:
if type_ in ['in', 'mvin', 'spin']:
return {
'debit': Decimal('0.0'),
'credit': amount,
}
elif type_ in ['out', 'mvout']:
elif type_ in ['out', 'mvout', 'spout']:
return {
'debit': amount,
'credit': Decimal('0.0'),