[MIG] document_page: Migration to 18.0

This commit is contained in:
Justine Doutreloux
2024-11-07 17:14:58 +01:00
parent adbf5ac757
commit a5aa3c86bc
7 changed files with 36 additions and 43 deletions

View File

@@ -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)