update education module
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
from odoo import fields, models
|
||||
from odoo import fields, models, api
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
class EductionClassGroup(models.Model):
|
||||
_name = 'education.class.group'
|
||||
_description = 'Education Class Group'
|
||||
_order = 'sequence'
|
||||
|
||||
class_ids = fields.One2many('education.class', 'class_group_id', string='Class of Groups')
|
||||
name = fields.Char(string='Name', translate=True, required=True)
|
||||
parent_id = fields.Many2one('education.class.group', string='Parent Group', ondelete='restrict')
|
||||
child_ids = fields.One2many('education.class.group', string='Child Groups', ondelete='restrict')
|
||||
class_ids = fields.One2many('education.class', 'class_group_id', string='Class of Groups')
|
||||
|
||||
_parent_store = True
|
||||
_parent_name = "parent_id"
|
||||
parent_path = fields.Char(index=True)
|
||||
|
||||
@api.constraints('parent_id')
|
||||
def _check_hierarchy(self):
|
||||
if not self._check_recursion():
|
||||
raise ValidationError('Error! You cannot create recursivecategories.')
|
||||
Reference in New Issue
Block a user