You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.7 KiB

  1. ==================================
  2. Add new options for many2one field
  3. ==================================
  4. Description
  5. -----------
  6. This modules modifies "many2one" and "many2manytags" form widgets so as to add some new display
  7. control options.
  8. **New: support many2manytags widget !**
  9. **New: support global option management with ir.config_parameter !**
  10. Options provided includes possibility to remove "Create..." and/or "Create and
  11. Edit..." entries from many2one drop down. You can also change default number of
  12. proposition appearing in the drop-down. Or prevent the dialog box poping in
  13. case of validation error.
  14. If not specified, the module will avoid proposing any of the create options
  15. if the current user have no permission rights to create the related object.
  16. Requirements
  17. ------------
  18. Was tested on openerp 8.0, trunk, saas-5 branch. New way to import js file. (thanks to tfossoul)
  19. New options
  20. -----------
  21. ``create`` *boolean* (Default: depends if user have create rights)
  22. Whether to display the "Create..." entry in dropdown panel.
  23. ``create_edit`` *boolean* (Default: depends if user have create rights)
  24. Whether to display "Create and Edit..." entry in dropdown panel
  25. ``m2o_dialog`` *boolean* (Default: depends if user have create rights)
  26. Whether to display the many2one dialog in case of validation error.
  27. ``limit`` *int* (Default: openerp default value is ``7``)
  28. Number of displayed record in drop-down panel
  29. ``search_more`` *boolean*
  30. Used to force disable/enable search more button.
  31. ``field_color`` *string*
  32. A string to define the field used to define color.
  33. This option has to be used with colors.
  34. ``colors`` *dictionary*
  35. A dictionary to link field value with a HTML color.
  36. This option has to be used with field_color.
  37. ir.config_parameter options
  38. ---------------------------
  39. Now you can disable "Create..." and "Create and Edit..." entry for all widgets in the odoo instance.
  40. If you disable one option, you can enable it for particular field by setting "create: True" option directly on the field definition.
  41. ``web_m2x_options.create`` *boolean* (Default: depends if user have create rights)
  42. Whether to display the "Create..." entry in dropdown panel for all fields in the odoo instance.
  43. ``web_m2x_options.create_edit`` *boolean* (Default: depends if user have create rights)
  44. Whether to display "Create and Edit..." entry in dropdown panel for all fields in the odoo instance.
  45. ``web_m2x_options.m2o_dialog`` *boolean* (Default: depends if user have create rights)
  46. Whether to display the many2one dialog in case of validation error for all fields in the odoo instance.
  47. ``web_m2x_options.limit`` *int* (Default: openerp default value is ``7``)
  48. Number of displayed record in drop-down panel for all fields in the odoo instance
  49. ``web_m2x_options.search_more`` *boolean* (Default: default value is ``False``)
  50. Whether the field should always show "Search more..." entry or not.
  51. To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like:
  52. - web_m2x_options.create: False
  53. - web_m2x_options.create_edit: False
  54. - web_m2x_options.m2o_dialog: False
  55. - web_m2x_options.limit: 10
  56. - web_m2x_options.search_more: True
  57. Example
  58. -------
  59. Your XML form view definition could contain::
  60. ...
  61. <field name="partner_id" options="{'limit': 10, 'create': false, 'create_edit': false, 'search_more':true 'field_color':'state', 'colors':{'active':'green'}}"/>
  62. ...
  63. Note
  64. ----
  65. Double check that you have no inherited view that remote ``options`` you set on a field !
  66. If nothing work, add a debugger in the first ligne of ``get_search_result method`` and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.