Package: odoo10-addon-web-m2x-options
Add new options for many2one fieldDescriptionThis modules modifies “many2one” and “many2manytags” form widgets so as to add some new display
control options.Options provided includes possibility to remove “Create…” and/or “Create and
Edit…” 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.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.UsageFor further information, please visit:https://www.odoo.com/forum/help-1in the field’s options dictcreateboolean(Default: depends if user have create rights)Whether to display the “Create…” entry in dropdown panel.create_editboolean(Default: depends if user have create rights)Whether to display “Create and Edit…” entry in dropdown panelm2o_dialogboolean(Default: depends if user have create rights)Whether to display the many2one dialog in case of validation error.limitint(Default: openerp default value is7)Number of displayed record in drop-down panelsearch_morebooleanUsed to force disable/enable search more button.field_colorstringA string to define the field used to define color.
This option has to be used with colors.colorsdictionaryA dictionary to link field value with a HTML color.
This option has to be used with field_color.no_open_editboolean(Default: value ofno_openwhich isFalseif not set)Causes a many2one not to offer to click through in edit mode, but well in read modeopenboolean(Default:False)Makes many2many_tags buttons that open the linked resourceno_color_pickerboolean(Default:False)Deactivates the color picker on many2many_tags buttons to do nothing (ignored if open is set)ir.config_parameter optionsNow you can disable “Create…” and “Create and Edit…” entry for all widgets in the odoo instance.
If you disable one option, you can enable it for particular field by setting “create: True” option directly on the field definition.web_m2x_options.createboolean(Default: depends if user have create rights)Whether to display the “Create…” entry in dropdown panel for all fields in the odoo instance.web_m2x_options.create_editboolean(Default: depends if user have create rights)Whether to display “Create and Edit…” entry in dropdown panel for all fields in the odoo instance.web_m2x_options.m2o_dialogboolean(Default: depends if user have create rights)Whether to display the many2one dialog in case of validation error for all fields in the odoo instance.web_m2x_options.limitint(Default: openerp default value is7)Number of displayed record in drop-down panel for all fields in the odoo instanceweb_m2x_options.search_moreboolean(Default: default value isFalse)Whether the field should always show “Search more…” entry or not.To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like:web_m2x_options.create: Falseweb_m2x_options.create_edit: Falseweb_m2x_options.m2o_dialog: Falseweb_m2x_options.limit: 10web_m2x_options.search_more: TrueExampleYour XML form view definition could contain:...
<field name="partner_id" options="{'limit': 10, 'create': false, 'create_edit': false, 'search_more':true 'field_color':'state', 'colors':{'active':'green'}}"/>
...Known issuesDouble check that you have no inherited view that removeoptionsyou set on a field !
If nothing works, add a debugger in the first line ofget_search_result methodand enable debug mode in Odoo. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.RoadmapInstead 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…).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.Include this feature as a configurable option via parameter to have this behaviour by default in all many2many tags.Bug TrackerBugs are tracked onGitHub 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 feedbackhere.CreditsContributorsDavid Coninckx <davconinckx@gmail.com>Emanuel Cino <ecino@compassion.ch>Holger Brunn <hbrunn@therp.nl>Nicolas JEUDY <nicolas@sudokeys.com>Yannick Vaucher <yannick.vaucher@camptocamp.com>Zakaria Makrelouf <z.makrelouf@gmail.com>Jairo Llopis <jairo.llopis@tecnativa.com>David Vidal <david.vidal@tecnativa.com>MaintainerThis module is maintained by the OCA.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.To contribute to this module, please visithttp://odoo-community.org.