line: datumsbereich prüfen + test,
abstimmung: vorgänger beachten + test line: party/transfer-book + test muß noch
This commit is contained in:
parent
7a07da852d
commit
30b91cf518
8 changed files with 465 additions and 28 deletions
48
line.py
48
line.py
|
@ -77,6 +77,23 @@ class Line(Workflow, ModelSQL, ModelView):
|
|||
required=True, readonly=True, depends=['currency_digits'])
|
||||
credit = fields.Numeric(string='Credit', digits=(16, Eval('currency_digits', 2)),
|
||||
required=True, readonly=True, depends=['currency_digits'])
|
||||
|
||||
booktransf = fields.Many2One(string='Transfer Cashbook',
|
||||
ondelete='RESTRICT', model_name='cashbook.book',
|
||||
domain=[('cashbook.owner.id', '=', Eval('context',{}).get('user', -1))],
|
||||
states={
|
||||
'readonly': STATES['readonly'],
|
||||
'invisible': ~Eval('bookingtype', '').in_(['mvin', 'mvout']),
|
||||
'required': Eval('bookingtype', '').in_(['mvin', 'mvout']),
|
||||
}, depends=DEPENDS+['bookingtype'])
|
||||
party = fields.Many2One(string='Party', model_name='party.party',
|
||||
ondelete='RESTRICT',
|
||||
states={
|
||||
'readonly': STATES['readonly'],
|
||||
'invisible': ~Eval('bookingtype', '').in_(['in', 'out']),
|
||||
'required': Eval('bookingtype', '').in_(['in', 'out']),
|
||||
}, depends=DEPENDS+['bookingtype'])
|
||||
|
||||
reconciliation = fields.Many2One(string='Reconciliation', readonly=True,
|
||||
model_name='cashbook.recon', ondelete='SET NULL',
|
||||
domain=[('cashbook.id', '=', Eval('cashbook'))],
|
||||
|
@ -147,7 +164,36 @@ class Line(Workflow, ModelSQL, ModelView):
|
|||
def wfcheck(cls, lines):
|
||||
""" line is checked
|
||||
"""
|
||||
pass
|
||||
pool = Pool()
|
||||
Recon = pool.get('cashbook.recon')
|
||||
|
||||
for line in lines:
|
||||
# deny if date is in range of existing reconciliation
|
||||
# allow cashbook-line at range-limits
|
||||
if Recon.search_count([
|
||||
('state', 'in', ['check', 'done']),
|
||||
('cashbook.id', '=', line.cashbook.id),
|
||||
('date_from', '<', line.date),
|
||||
('date_to', '>', line.date),
|
||||
]) > 0:
|
||||
raise UserError(gettext(
|
||||
'cashbook.msg_line_err_write_to_reconciled',
|
||||
datetxt = Report.format_date(line.date),
|
||||
))
|
||||
# deny if date is at reconciliation limits and two
|
||||
# reconciliations exist
|
||||
if Recon.search_count([
|
||||
('state', 'in', ['check', 'done']),
|
||||
('cashbook.id', '=', line.cashbook.id),
|
||||
['OR',
|
||||
('date_from', '=', line.date),
|
||||
('date_to', '=', line.date),
|
||||
]
|
||||
]) > 1:
|
||||
raise UserError(gettext(
|
||||
'cashbook.msg_line_err_write_to_reconciled',
|
||||
datetxt = Report.format_date(line.date),
|
||||
))
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue