Metadata-Version: 2.1
Name: odoo13-addon-cms-delete-content
Version: 13.0.1.0.1.dev10
Summary: Basic features for handling content deletion via frontend.
Home-page: UNKNOWN
Author: Camptocamp,Odoo Community Association (OCA)
Author-email: support@odoo-community.org
License: LGPL-3
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Requires-Python: >=3.5
Requires-Dist: odoo13-addon-cms-info
Requires-Dist: odoo13-addon-cms-status-message
Requires-Dist: odoo (<13.1dev,>=13.0a)

==================
CMS delete content
==================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
    :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
    :alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite--cms-lightgray.png?logo=github
    :target: https://github.com/OCA/website-cms/tree/13.0/cms_delete_content
    :alt: OCA/website-cms
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/website-cms-13-0/website-cms-13-0-cms_delete_content
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
    :target: https://runbot.odoo-community.org/runbot/225/13.0
    :alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5| 

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

**Table of contents**

.. contents::
   :local:

Usage
=====

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

.. code:: python

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

.. code:: xml

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

Known issues / Roadmap
======================


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

Changelog
=========

11.0.1.0.2 (2018-04-27)
~~~~~~~~~~~~~~~~~~~~~~~

**Fixes**

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


11.0.1.0.1 (2018-04-24)
~~~~~~~~~~~~~~~~~~~~~~~

**Fixes**

* Update JS according to `cms_status_message` updates


11.0.1.0.0 (2018-01-18)
~~~~~~~~~~~~~~~~~~~~~~~

* Initial release

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/website-cms/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/website-cms/issues/new?body=module:%20cms_delete_content%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Camptocamp

Contributors
~~~~~~~~~~~~

* Simone Orsi <simone.orsi@camptocamp.com>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

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 <https://github.com/OCA/website-cms/tree/13.0/cms_delete_content>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.


