mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-19 11:52:18 -06:00
[MIG] document_page: Migration to 18.0
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
# 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
|
||||
|
||||
|
||||
@@ -111,8 +111,8 @@ class DocumentPage(models.Model):
|
||||
|
||||
@api.constrains("parent_id")
|
||||
def _check_parent_id(self):
|
||||
if not self._check_recursion():
|
||||
raise ValidationError(_("You cannot create recursive categories."))
|
||||
if self._has_cycle():
|
||||
raise ValidationError(self.env._("You cannot create recursive categories."))
|
||||
|
||||
def _get_page_index(self, link=True):
|
||||
"""Return the index of a document."""
|
||||
@@ -184,9 +184,9 @@ class DocumentPage(models.Model):
|
||||
def copy(self, default=None):
|
||||
default = dict(
|
||||
default or {},
|
||||
name=_("%s (copy)") % self.name,
|
||||
name=self.env._("%s (copy)") % self.name,
|
||||
content=self.content,
|
||||
draft_name="1.0",
|
||||
draft_summary=_("summary"),
|
||||
draft_summary=self.env._("summary"),
|
||||
)
|
||||
return super().copy(default=default)
|
||||
|
||||
Reference in New Issue
Block a user