Skip to content

Commit

Permalink
cms_info: add cms_copy_url
Browse files Browse the repository at this point in the history
  • Loading branch information
simahawk committed Feb 6, 2025
1 parent 4a6fbac commit 46da15d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cms_info/models/cms_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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 {
Expand Down

0 comments on commit 46da15d

Please sign in to comment.