OdooWiki OCA HUB

CMS delete content

cms_delete_content folder_open OCA/website-cms open_in_new
Uncategorised License: LGPL-3

Basic features for deleting content via frontend.

Features

  • register your own custom delete confirmation view per-model
  • use cms_status_message to show confirmation message for deletion
  • generic template for asking delete confirmation
  • new fields and parameters on website.published.mixin to handle delete links and redirects

auto_awesome What this module does

AI-generated from the code · Odoo 13.0

Lets website visitors delete content from the frontend through a confirmation pop-up, then shows a status message or redirects them afterwards.

This module adds a frontend deletion flow for website content. When a page element carries the cms_delete_confirm class, clicking it opens a modal dialog asking "Are you sure you want to delete this item?" with Confirm and Cancel buttons.

  • The confirmation pop-up is rendered from a generic template, so any model can reuse it.
  • Confirming sends the request to the server, which deletes the record and returns a result handled by JavaScript.
  • If a redirect target is provided, the user is sent there after a short delay and a status message is added to the website; otherwise the confirmation message is injected directly into the page.
  • The module extends cms.info.mixin with two helper methods that produce the confirmation question and the "deleted" message, using the model's description in the text.
  • It relies on cms_status_message to display the result message and on cms_info for the delete link and redirect fields.

It touches the website frontend assets and the cms.info.mixin abstract model. No new menus or backend screens are added; everything happens on the website through the modal and the status message area.

Required by other modules

Models and fields (1)
  • cms.info.mixin · extends an existing model

Text generated by AI (DeepSeek) from reading the Odoo 13.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 1 confirmed, 8 with no information of 9 versions.

Sources · Odoo 13.0

Confirmed on 2026-11-03 in branch 13.0 of OCA/website-cms.

terminal Installation and usage

OCA documentation · Odoo 13.0

Delete button and behavior

To add a delete button:

.. code:: html

    <a class="btn btn-danger cms_delete_confirm" t-att-href="object.cms_delete_confirm_url">Delete</a>

When you click on a confirmation dialog pops up.

If you hit ``cancel`` the popup is closed. If you hit submit the item is
deleted and you get redirected to your model's ``cms_after_delete_url``.
By default is ``/``.

**Customization**

Custom per-model delete message
class MyModel(models.Model):
    _inherit = "my.model"

    @api.multi
    def msg_content_delete_confirm(self):
        self.ensure_one()
        return _('Are you sure you want to delete "%s"?.') % self.name

Custom "after delete URL"

When you are viewing a content and you delete it you want to be
redirected to some other place.

By default you get redirected to the root of the website.

To change this behavior just override the attribute in your model
declaration:

.. code:: python

    class MyModel(models.Model):
        _inherit = "my.model"

        cms_after_delete_url = '/foo'

Note: if you want to customize it on demand for particular pages, or you
are deleting an item from another page (like a management page) you can
pass ``?redirect=`` in the url, like:

.. code:: html

    <a class="btn btn-danger cms_delete_confirm" t-attf-href="#{object.cms_delete_confirm_url}?redirect=">Delete</a>

Custom global delete confirm message appeareance
<template id="delete_confirm" inherit_id="cms_delete_content.delete_confirm">

    <xpath expr="//h4[@id='delete_confirm']" position="replace">
        <h1 t-esc="main_object.msg_content_delete_confirm()">I want it bigger!</h1>
    </xpath>

</template>

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.