Adding a color field to a project

Good day sirs,

I am currently modifying the axelor-project module.

Is there a best way to implement a colorStatus field that will be an enum of four diffrent value of hex colors and would like to make a block of div with backgroud-color of a given hex value indicating the color status of the project?

I added a field on Project.xml:

but somehow I could not get the value of of project.colorStatus which is suppose to be a hex value.



The bast way is to create a String field in your domain that point to a selection:

  1. add the field in your domain
    <String name="colorStatus" selection="my.color.status"/>
  2. declare the selection inside a view
    <selection name="my.color.status"> <option value="#FF0000">RED</option> <option value="#00FF00">GREEN</option> <option value="#0000FF">BLUE</option> <selection/>

Now, you will see RED/GREEN/BLUE as labels in your form and you can retreive the hex using the field value.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.