mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-16 04:02:56 -06:00
[IMP] check recusion when select parent
This commit is contained in:
parent
2300c2bcfb
commit
7f5f19a95f
@ -1,7 +1,8 @@
|
|||||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models, _
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
class DocumentPage(models.Model):
|
class DocumentPage(models.Model):
|
||||||
@ -112,6 +113,11 @@ class DocumentPage(models.Model):
|
|||||||
ondelete='cascade',
|
ondelete='cascade',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@api.constrains('parent_id')
|
||||||
|
def _check_parent_id(self):
|
||||||
|
if not self._check_recursion():
|
||||||
|
raise ValidationError(_('You cannot create recursive categories.'))
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _get_page_index(self, link=True):
|
def _get_page_index(self, link=True):
|
||||||
"""Return the index of a document."""
|
"""Return the index of a document."""
|
||||||
|
Loading…
Reference in New Issue
Block a user