kategorie: sperrt 'Typ' wenn parent existiert, korrekte Anpassung

der sub-kategorien bei Änderung + test
Line: Kategoriefeld prüft Inhalt + tests
This commit is contained in:
Frederik Jaeckel 2022-08-11 11:06:28 +02:00
parent 52ffa0536e
commit 8fd6e0d339
7 changed files with 137 additions and 46 deletions

View file

@ -5,7 +5,7 @@
from trytond.model import ModelView, ModelSQL, Workflow, fields, Check
from trytond.pool import Pool
from trytond.pyson import Eval, If, Or
from trytond.pyson import Eval, If, Or, Bool
from trytond.transaction import Transaction
from trytond.report import Report
from trytond.exceptions import UserError
@ -53,7 +53,12 @@ class Line(Workflow, ModelSQL, ModelView):
states=STATES, depends=DEPENDS)
category = fields.Many2One(string='Category', required=True,
model_name='cashbook.category', ondelete='RESTRICT',
states=STATES, depends=DEPENDS+['bookingtype'],
states={
'readonly': Or(
STATES['readonly'],
Bool(Eval('bookingtype')) == False,
),
}, depends=DEPENDS+['bookingtype'],
domain=[
If(
Eval('bookingtype', '').in_(['in', 'mvin']),