formatting, line: test for delete of party

This commit is contained in:
Frederik Jaeckel 2023-05-18 12:15:53 +02:00
parent 78f160bf0b
commit 619a17bcd6
16 changed files with 701 additions and 516 deletions

View file

@ -25,22 +25,27 @@ class Category(tree(separator='/'), ModelSQL, ModelView):
name = fields.Char(string='Name', required=True, translate=True)
description = fields.Char(string='Description', translate=True)
cattype = fields.Selection(string='Type', required=True,
cattype = fields.Selection(
string='Type', required=True,
help='Type of Category', selection=sel_categorytype,
states={'readonly': Bool(Eval('parent_cattype'))},
domain=[If(Bool(Eval('parent_cattype')),
('cattype', '=', Eval('parent_cattype', '')),
())],
depends=['parent_cattype'])
parent_cattype = fields.Function(fields.Char(string='Parent Category Type',
parent_cattype = fields.Function(fields.Char(
string='Parent Category Type',
readonly=True, states={'invisible': True}),
'on_change_with_parent_cattype')
company = fields.Many2One(string='Company', model_name='company.company',
company = fields.Many2One(
string='Company', model_name='company.company',
required=True, ondelete="RESTRICT")
parent = fields.Many2One(string="Parent",
parent = fields.Many2One(
string="Parent",
model_name='cashbook.category', ondelete='RESTRICT')
childs = fields.One2Many(string='Children', field='parent',
childs = fields.One2Many(
string='Children', field='parent',
model_name='cashbook.category')
@classmethod
@ -61,7 +66,8 @@ class Category(tree(separator='/'), ModelSQL, ModelView):
Unique(t, t.name, t.company, t.parent),
'cashbook.msg_category_name_unique'),
('name2_uniq',
Exclude(t,
Exclude(
t,
(t.name, Equal),
(t.cattype, Equal),
where=(t.parent == None)),
@ -106,9 +112,8 @@ class Category(tree(separator='/'), ModelSQL, ModelView):
if category.parent.cattype != category.cattype:
raise UserError(gettext(
'cashbook.msg_category_type_not_like_parent',
parentname = category.parent.rec_name,
catname = category.rec_name,
))
parentname=category.parent.rec_name,
catname=category.rec_name,))
@classmethod
def create(cls, vlist):