Author: |
Camptocamp,Odoo Community Association (OCA) |
License: |
LGPL-3 |
Branch: |
13.0 |
Repository: |
Change2improve/website-cms |
Dependencies: |
cms_info,
cms_status_message,
and
website |
Languages: |
Cucumber (1, 0.1%),
HTML (419, 55.9%),
JavaScript (63, 8.4%),
PO File (34, 4.5%),
Python (154, 20.6%),
and
XML (78, 10.4%) |
Other branches: |
10.0,
11.0,
and
9.0 |
Other repositories: |
BTETON/website-cms,
CompassionCH/website-cms,
ERPLibre/website-cms,
ForgeFlow/website-cms,
Gabinete-Digital/website-cms,
Guobower/website-cms,
Ingeos/website-cms,
JazziMc/website-cms,
MjAbuz/website-cms,
NL66278/website-cms,
NeatNerdPrime/website-cms,
Nooka10/website-cms,
OCA/website-cms,
PCatinean/website-cms,
SeuMarco/website-cms,
TDu/website-cms,
TelmoSenseFly/website-cms,
VisiionSolucionesTecnologicas/website-cms,
akretion/website-cms,
anhvu-sg/website-cms,
apetbiz/website-cms,
bishalgit/website-cms,
bvkl/website-cms,
caiuka/website-cms,
camptocamp/website-cms,
elvirekemajou/website-cms,
gfcapalbo/website-cms,
grindtildeath/website-cms,
haroldtamo/website-cms,
hbrunn/website-cms,
hinfo506/website-cms,
isoscl/website-cms,
josueBulle/website-cms,
kevin070982/website-cms,
leemannd/website-cms,
lideritjnma/website-cms,
lukehuang/website-cms,
one2pret/website-cms,
ossamagharib/website-cms,
pscloud/website-cms,
py-web/website-cms,
ravishekharco/website-cms,
redcor/website-cms,
rsullivan2704/website-cms,
sanube/website-cms,
simahawk/website-cms,
steingabelgaard/website-cms,
wahello/website-cms,
and
x0rzkov/odoo-website-cms |
<h1 class="title">CMS delete content</h1>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/website-cms/tree/13.0/cms_delete_content"><img alt="OCA/website-cms" src="https://img.shields.io/badge/github-OCA%2Fwebsite--cms-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/website-cms-13-0/website-cms-13-0-cms_delete_content"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/225/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Basic features for deleting content via frontend.</p>
<a name="features"></a>
<h2>Features</h2>
<ul class="simple">
<li>register your own custom delete confirmation view per-model</li>
<li>use <code>cms_status_message</code> to show confirmation message for deletion</li>
<li>generic template for asking delete confirmation</li>
<li>new fields and parameters on <code>website.published.mixin</code> to handle
delete links and redirects</li>
</ul>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="id4">Usage</a></li>
</ul>
</div>
<a name="usage"></a>
<h3><a class="toc-backref" href="#id4">Usage</a></h3>
<a name="delete-button-and-behavior"></a>
<h2>Delete button and behavior</h2>
<p>To add a delete button:</p>
<pre>
<code lang="html"><a class="btn btn-danger cms_delete_confirm" t-att-href="object.cms_delete_confirm_url">Delete</a></code>
</pre>
<p>When you click on a confirmation dialog pops up.</p>
<p>If you hit <code>cancel</code> the popup is closed. If you hit submit the item is
deleted and you get redirected to your model's <code>cms_after_delete_url</code>.
By default is <code>/</code>.</p>
<p><strong>Customization</strong></p>
<a name="custom-per-model-delete-message"></a>
<h2>Custom per-model delete message</h2>
<pre>
<code lang="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</code>
</pre>
<a name="custom-after-delete-url"></a>
<h2>Custom "after delete URL"</h2>
<p>When you are viewing a content and you delete it you want to be
redirected to some other place.</p>
<p>By default you get redirected to the root of the website.</p>
<p>To change this behavior just override the attribute in your model
declaration:</p>
<pre>
<code lang="python">class MyModel(models.Model):
_inherit = "my.model"
cms_after_delete_url = '/foo'</code>
</pre>
<p>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 <code>?redirect=</code> in the url, like:</p>
<pre>
<code lang="html"><a class="btn btn-danger cms_delete_confirm" t-attf-href="#{object.cms_delete_confirm_url}?redirect=">Delete</a></code>
</pre>
<a name="custom-global-delete-confirm-message-appeareance"></a>
<h2>Custom global delete confirm message appeareance</h2>
<pre>
<code lang="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></code>
</pre>
<a name="known-issues-roadmap"></a>
<h3>Known issues / Roadmap</h3>
<p>Get rid of <cite>website</cite> dependency to be able to use it w/ <cite>portal</cite> module only.</p>
<a name="changelog"></a>
<h3>Changelog</h3>
<a name="id1"></a>
<h2>11.0.1.0.2 (2018-04-27)</h2>
<p><strong>Fixes</strong></p>
<ul>
<li><p class="first">Fix tests: use real fake models</p>
<p>Old approach for fake test models was giving bad behaviors
even if the tests were not ran for this module.</p>
<p>Now we init a real fake model only on test run.</p>
</li>
</ul>
<a name="id2"></a>
<h2>11.0.1.0.1 (2018-04-24)</h2>
<p><strong>Fixes</strong></p>
<ul class="simple">
<li>Update JS according to <cite>cms_status_message</cite> updates</li>
</ul>
<a name="id3"></a>
<h2>11.0.1.0.0 (2018-01-18)</h2>
<ul class="simple">
<li>Initial release</li>
</ul>
<a name="bug-tracker"></a>
<h3>Bug Tracker</h3>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/website-cms/issues">GitHub Issues</a>.
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
<a class="reference external" href="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**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
<a name="credits"></a>
<h3>Credits</h3>
<a name="authors"></a>
<h2>Authors</h2>
<ul class="simple">
<li>Camptocamp</li>
</ul>
<a name="contributors"></a>
<h2>Contributors</h2>
<ul class="simple">
<li>Simone Orsi <<a class="reference external" href="mailto:simone.orsi@camptocamp.com">simone.orsi@camptocamp.com</a>></li>
</ul>
<a name="maintainers"></a>
<h2>Maintainers</h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/website-cms/tree/13.0/cms_delete_content">OCA/website-cms</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>