line/book: sequence für zeilen-nummerierung

This commit is contained in:
Frederik Jaeckel 2022-08-16 16:24:07 +02:00
parent 5fdbb0ce89
commit a801775880
8 changed files with 128 additions and 17 deletions

23
book.py
View file

@ -4,7 +4,7 @@
# full copyright notices and license terms.
from trytond.model import Workflow, ModelView, ModelSQL, fields, Check
from trytond.pyson import Eval, Or, Bool
from trytond.pyson import Eval, Or, Bool, Id
from trytond.exceptions import UserError
from trytond.i18n import gettext
from trytond.transaction import Transaction
@ -55,6 +55,19 @@ class Book(Workflow, ModelSQL, ModelView):
reconciliations = fields.One2Many(string='Reconciliations',
field='cashbook', model_name='cashbook.recon',
states=STATES, depends=DEPENDS)
number_sequ = fields.Many2One(string='Line numbering', required=True,
help='Number sequence for numbering of the cash book lines.',
model_name='ir.sequence',
domain=[
('sequence_type', '=', Id('cashbook', 'sequence_type_cashbook_line')),
['OR',
('company', '=', None),
('company', '=', Eval('company', -1)),
],
],
states=STATES, depends=DEPENDS+['company'])
number_atcheck = fields.Boolean(string="number when 'Checking'",
help="The numbering of the lines is done in the step Check. If the check mark is inactive, this happens with Done.")
start_balance = fields.Numeric(string='Initial Amount', required=True,
states={
'readonly': Or(
@ -107,6 +120,14 @@ class Book(Workflow, ModelSQL, ModelView):
},
})
@classmethod
def default_number_atcheck(cls):
return True
@classmethod
def default_start_number(cls):
return 1
@classmethod
def default_start_balance(cls):
""" zero