kassenbuchtyp: Feld 'feature'

This commit is contained in:
Frederik Jaeckel 2022-12-21 19:12:39 +01:00
parent db84bf7097
commit 82afd24c20
9 changed files with 68 additions and 0 deletions

View file

@ -5,6 +5,7 @@
from trytond.model import ModelView, ModelSQL, fields, Unique
from trytond.transaction import Transaction
from trytond.i18n import gettext
class Type(ModelSQL, ModelView):
@ -15,6 +16,9 @@ class Type(ModelSQL, ModelView):
short = fields.Char(string='Abbreviation', required=True, size=3)
company = fields.Many2One(string='Company', model_name='company.company',
required=True, ondelete="RESTRICT")
feature = fields.Selection(string='Feature', required=True,
selection='get_sel_feature',
help='Select feature set of the Cashbook.')
@classmethod
def __setup__(cls):
@ -25,6 +29,18 @@ class Type(ModelSQL, ModelView):
('code_uniq', Unique(t, t.short), 'cashbook.msg_type_short_unique'),
])
@classmethod
def default_feature(cls):
""" default: general
"""
return 'gen'
@classmethod
def get_sel_feature(cls):
""" get feature-modes
"""
return [('gen', gettext('cashbook.msg_btype_general'))]
def get_rec_name(self, name):
""" short + name
"""