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.

116 lines
3.7 KiB

  1. ==================================
  2. Add new options for many2one field
  3. ==================================
  4. Description
  5. -----------
  6. This module changes "many2one" and "many2manytags" form widgets, so as to
  7. add some new display control options.
  8. ** New: support many2manytags widget ! **
  9. ** New: support global option management with ir.config_parameter ! **
  10. The options provided include the possibility to remove "Create..." and/or
  11. "Create and Edit..." entries from many2one and many2many drop down lists. You
  12. can also change the default number of entries appearing in the drop-down, or
  13. prevent the dialog box poping in case of validation error occurring.
  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 v7.0
  19. New option
  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 records 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 line 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.