CMS delete content

CMS delete content

Available versions
Required themes
Website (website)
Technical name
Secure dependencies
CMS delete content

CMS delete content

Beta License: LGPL-3 OCA/website-cms Translate me on Weblate Try me on Runboat

Basic features for deleting content via frontend.


  • 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

Table of contents

Delete button and behavior

To add a delete button:

<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 /.


Custom per-model delete message

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

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

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:

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:

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


Known issues / Roadmap

Get rid of website dependency to be able to use it w/ portal module only.

Changelog (2021-08-23) Features

  • Migration to v13 (#111) (2018-04-27)


  • Fix tests: use real fake models

    Old approach for fake test models was giving bad behaviors even if the tests were not ran for this module.

    Now we init a real fake model only on test run. (2018-04-24)


  • Update JS according to cms_status_message updates (2018-01-18)

  • Initial release

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.



  • Camptocamp



This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

This module is part of the OCA/website-cms project on GitHub.

You are welcome to contribute. To learn how please visit

0.0 / 5.0
based on 0 ratings

Python dependencies

Package Version Secured
Werkzeug 0.16.1
lxml 4.6.1
mock 3.0.5
odoo_test_helper 2.1.1

Available languages

Language % translated
Italian / Italiano
Spanish / Español
German / Deutsch