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.

43 lines
956 B

  1. You need to declare a char field::
  2. color = fields.Char(
  3. string="Color",
  4. help="Choose your color"
  5. )
  6. In the view declaration, put widget='color' attribute in the field tag::
  7. ...
  8. <field name="arch" type="xml">
  9. <tree string="View name">
  10. ...
  11. <field name="color" widget="color"/>
  12. ...
  13. </tree>
  14. </field>
  15. ...
  16. <field name="arch" type="xml">
  17. <form string="View name">
  18. ...
  19. <field name="color" widget="color"/>
  20. ...
  21. </form>
  22. </field>
  23. ...
  24. Widget Options::
  25. - readonly_mode
  26. - 'default' > Color Box + text
  27. - 'color' > Only Color Box
  28. - 'text' > Only Text
  29. ...
  30. <field name="arch" type="xml">
  31. <tree string="View name">
  32. ...
  33. <field name="color" widget="color" options="{'readonly_mode': 'color'}"/>
  34. ...
  35. </tree>
  36. </field>
  37. ...