Search 1.9 billion lines of Odoo code on GitHub

web_button_dynamic_confirm_msg

Author: ACSONE SA/NV,Odoo Community Association (OCA)
License: AGPL-3
Branch: 9.0-web_button_dynamic_confirm_msg_zak
Repository: acsone/web
Dependencies: web
Languages: JavaScript (37, 21.1%), Python (16, 9.1%), SVG (77, 44.0%), XML (8, 4.6%), and reStructuredText (37, 21.1%)

<a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.svg"> </a> <a name="web-button-dynamic-confirm-msg"></a> <h2>Web Button Dynamic Confirm Msg</h2> <p>When defining a button on a view (i.e form view or a list view) you can specify a confirmation message to be displayed to the user when the button is clicked.</p> <pre> <code lang="xml">&lt;button name=&quot;action_method&quot; type=&quot;object&quot; confirm=&quot;confirm message&quot;/&gt;</code> </pre> <p>The confirm message is static and independent of the context on which the action will be executed.</p> <p>In order to mitigate this limitation, this new addons will allow you to use the value of a field as the confirmation message in the xml definition of the view.</p> <pre> <code lang="xml">&lt;field name=&quot;msg_field&quot; invisible=&quot;1&quot;/&gt; &lt;button name=&quot;action_method&quot; type=&quot;object&quot; confirm=&quot;msg_field&quot;/&gt;</code> </pre> <p>The field used for the confirmation message must be provided as following</p> <pre> <code lang="python">msg_field = fields.Text( compute='_compute_msg_field', readonly=True, ) def _compute_msg_field(self): for rec in self: rec.msg_field = &quot;confirm message&quot;</code> </pre> <a name="usage"></a> <h3>Usage</h3> <a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/{repo_id}/{branch}"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a> <a name="known-issues-roadmap"></a> <h3>Known issues / Roadmap</h3> <ul class="simple"> <li>...</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/web/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 feedback.</p> <a name="credits"></a> <h3>Credits</h3> <a name="images"></a> <h4>Images</h4> <ul class="simple"> <li>Odoo Community Association: <a class="reference external" href="https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg">Icon</a>.</li> </ul> <a name="contributors"></a> <h4>Contributors</h4> <ul class="simple"> <li>Zakaria Makrelouf &lt;<a class="reference external" href="mailto:z.makrelouf&#64;gmail.com">z.makrelouf&#64;gmail.com</a>&gt;</li> <li>Second Person &lt;<a class="reference external" href="mailto:second.person&#64;example.org">second.person&#64;example.org</a>&gt;</li> </ul> <a name="maintainer"></a> <h4>Maintainer</h4> <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>This module is maintained by the OCA.</p> <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>To contribute to this module, please visit <a class="reference external" href="https://odoo-community.org">https://odoo-community.org</a>.</p>