Search 1.9 billion lines of Odoo code on GitHub

web_m2x_options_custom

Author: 0k.io,Odoo Community Association (OCA)+Pharmadus
License: AGPL-3
Branch: dev
Repository: Comunitea/CMNT_010_15_PHA
Dependencies: base, and web
Languages: HTML (332, 35.1%), JavaScript (327, 34.6%), PO File (154, 16.3%), Python (15, 1.6%), XML (23, 2.4%), and reStructuredText (94, 9.9%)
Other branches: dev_connector_amazon, master, and master_update_devel_PHA
Other repositories: informaticaph/PXGO_00064_2014_PHA

<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="add-new-options-for-many2one-field"></a> <h2>Add new options for many2one field</h2> <p>This modules modifies &quot;many2one&quot; and &quot;many2manytags&quot; form widgets so as to add some new display control options.</p> <p>Options provided includes possibility to remove &quot;Create...&quot; and/or &quot;Create and Edit...&quot; entries from many2one drop down. You can also change default number of proposition appearing in the drop-down. Or prevent the dialog box poping in case of validation error.</p> <p>If not specified, the module will avoid proposing any of the create options if the current user has no permission rights to create the related object.</p> <a name="usage"></a> <h3>Usage</h3> <a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/162/8.0"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a> <p>For further information, please visit:</p> <ul class="simple"> <li><a class="reference external" href="https://www.odoo.com/forum/help-1">https://www.odoo.com/forum/help-1</a></li> </ul> <a name="in-the-field-s-options-dict"></a> <h4>in the field's options dict</h4> <p><code>create</code> <em>boolean</em> (Default: depends if user have create rights)</p> <blockquote> Whether to display the &quot;Create...&quot; entry in dropdown panel.</blockquote> <p><code>create_edit</code> <em>boolean</em> (Default: depends if user have create rights)</p> <blockquote> Whether to display &quot;Create and Edit...&quot; entry in dropdown panel</blockquote> <p><code>m2o_dialog</code> <em>boolean</em> (Default: depends if user have create rights)</p> <blockquote> Whether to display the many2one dialog in case of validation error.</blockquote> <p><code>limit</code> <em>int</em> (Default: openerp default value is <code>7</code>)</p> <blockquote> Number of displayed record in drop-down panel</blockquote> <p><code>search_more</code> <em>boolean</em></p> <blockquote> Used to force disable/enable search more button.</blockquote> <p><code>field_color</code> <em>string</em></p> <blockquote> A string to define the field used to define color. This option has to be used with colors.</blockquote> <p><code>colors</code> <em>dictionary</em></p> <blockquote> A dictionary to link field value with a HTML color. This option has to be used with field_color.</blockquote> <p><code>no_open_edit</code> <em>boolean</em> (Default: value of <code>no_open</code> which is <code>False</code> if not set)</p> <blockquote> Causes a many2one not to offer to click through in edit mode, but well in read mode</blockquote> <p><code>open</code> <em>boolean</em> (Default: <code>False</code>)</p> <blockquote> Makes many2many_tags buttons that open the linked resource</blockquote> <a name="ir-config-parameter-options"></a> <h4>ir.config_parameter options</h4> <p>Now you can disable &quot;Create...&quot; and &quot;Create and Edit...&quot; entry for all widgets in the odoo instance. If you disable one option, you can enable it for particular field by setting &quot;create: True&quot; option directly on the field definition.</p> <p><code>web_m2x_options.create</code> <em>boolean</em> (Default: depends if user have create rights)</p> <blockquote> Whether to display the &quot;Create...&quot; entry in dropdown panel for all fields in the odoo instance.</blockquote> <p><code>web_m2x_options.create_edit</code> <em>boolean</em> (Default: depends if user have create rights)</p> <blockquote> Whether to display &quot;Create and Edit...&quot; entry in dropdown panel for all fields in the odoo instance.</blockquote> <p><code>web_m2x_options.m2o_dialog</code> <em>boolean</em> (Default: depends if user have create rights)</p> <blockquote> Whether to display the many2one dialog in case of validation error for all fields in the odoo instance.</blockquote> <p><code>web_m2x_options.limit</code> <em>int</em> (Default: openerp default value is <code>7</code>)</p> <blockquote> Number of displayed record in drop-down panel for all fields in the odoo instance</blockquote> <p><code>web_m2x_options.search_more</code> <em>boolean</em> (Default: default value is <code>False</code>)</p> <blockquote> Whether the field should always show &quot;Search more...&quot; entry or not.</blockquote> <p>To add these parameters go to Configuration -&gt; Technical -&gt; Parameters -&gt; System Parameters and add new parameters like:</p> <ul class="simple"> <li>web_m2x_options.create: False</li> <li>web_m2x_options.create_edit: False</li> <li>web_m2x_options.m2o_dialog: False</li> <li>web_m2x_options.limit: 10</li> <li>web_m2x_options.search_more: True</li> </ul> <a name="example"></a> <h4>Example</h4> <p>Your XML form view definition could contain:</p> <pre> <code>... &lt;field name=&quot;partner_id&quot; options=&quot;{'limit': 10, 'create': false, 'create_edit': false, 'search_more':true 'field_color':'state', 'colors':{'active':'green'}}&quot;/&gt; ...</code> </pre> <a name="known-issues"></a> <h3>Known issues</h3> <p>Double check that you have no inherited view that remove <code>options</code> you set on a field ! If nothing works, add a debugger in the first line of <code>get_search_result method</code> and enable debug mode in Odoo. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.</p> <a name="roadmap"></a> <h3>Roadmap</h3> <ul class="simple"> <li>Instead of making the tags rectangle clickable, I think it's better to put the text as a clickable link, so we will get a consistent behaviour/aspect with other clickable elements (many2one...).</li> <li>In edit mode, it would be great to add an icon like the one on many2one fields to allow to open the many2many in a popup window.</li> <li>Include this feature as a configurable option via parameter to have this behaviour by default in all many2many tags.</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 <a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_m2x_options%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">here</a>.</p> <a name="credits"></a> <h3>Credits</h3> <a name="contributors"></a> <h4>Contributors</h4> <ul class="simple"> <li>David Coninckx &lt;<a class="reference external" href="mailto:davconinckx&#64;gmail.com">davconinckx&#64;gmail.com</a>&gt;</li> <li>Emanuel Cino &lt;<a class="reference external" href="mailto:ecino&#64;compassion.ch">ecino&#64;compassion.ch</a>&gt;</li> <li>Holger Brunn &lt;<a class="reference external" href="mailto:hbrunn&#64;therp.nl">hbrunn&#64;therp.nl</a>&gt;</li> <li>Nicolas JEUDY &lt;<a class="reference external" href="mailto:nicolas&#64;sudokeys.com">nicolas&#64;sudokeys.com</a>&gt;</li> <li>Yannick Vaucher &lt;<a class="reference external" href="mailto:yannick.vaucher&#64;camptocamp.com">yannick.vaucher&#64;camptocamp.com</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="http://odoo-community.org">http://odoo-community.org</a>.</p>