From 1f9171e4c22c0534c4866148c1a45611608d44c6 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Thu, 3 Aug 2023 16:18:40 +0200 Subject: [PATCH 1/2] cms_info: use compute_sudo for urls --- cms_info/models/cms_mixin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cms_info/models/cms_mixin.py b/cms_info/models/cms_mixin.py index 31b5c633..a78e1216 100644 --- a/cms_info/models/cms_mixin.py +++ b/cms_info/models/cms_mixin.py @@ -35,18 +35,22 @@ def cms_after_delete_url(self): url = fields.Char( string="URL", compute="_compute_cms_url", + compute_sudo=True, ) cms_edit_url = fields.Char( string="CMS edit URL", compute="_compute_cms_url", + compute_sudo=True, ) cms_delete_url = fields.Char( string="CMS delete URL", compute="_compute_cms_url", + compute_sudo=True, ) cms_delete_confirm_url = fields.Char( string="CMS delete confirm URL", compute="_compute_cms_url", + compute_sudo=True, ) def _compute_cms_url(self): From e475d4f04cddf6e02f13d8a9fc99d1c737505571 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Fri, 4 Aug 2023 14:18:56 +0200 Subject: [PATCH 2/2] cms_info: add cms_copy_url --- cms_info/models/cms_mixin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cms_info/models/cms_mixin.py b/cms_info/models/cms_mixin.py index a78e1216..e0bc97ce 100644 --- a/cms_info/models/cms_mixin.py +++ b/cms_info/models/cms_mixin.py @@ -52,11 +52,17 @@ def cms_after_delete_url(self): compute="_compute_cms_url", compute_sudo=True, ) + cms_copy_url = fields.Char( + string="CMS copy URL", + compute="_compute_cms_url", + compute_sudo=True, + ) def _compute_cms_url(self): for rec in self: rec.url = rec._get_cms_url() rec.cms_edit_url = rec._get_cms_edit_url() + rec.cms_copy_url = rec._get_cms_copy_url() rec.update(rec._get_cms_delete_urls()) def _get_cms_url(self): @@ -69,6 +75,10 @@ def _get_cms_edit_url(self): base_edit_url = self.cms_edit_url_base return f"{base_edit_url}/{self.id}" + def _get_cms_copy_url(self): + base_url = self._cms_make_url("copy") + return f"{base_url}/{self.id}" + def _get_cms_delete_urls(self): base_url = self.cms_delete_url_base return {