Field dynamic icon


I don’t understand how to dynamically assign an icon to a field.

I added an icon on a field,

<field name="margin_percent" icon="red-chip" symbol="%"/>
  1. but how to make the icon change according to the value of the field?

value > 6, icon=green
value <= 6 , icon=orange
value <= 0, icon=red

  1. Is it possible to put the icon after the value instead of in front?

The content of the attribute icon must be the name of a field (but it fall back to a direct icon name if the field does not exist). So this field should contain the name of the icon to display. So usually it is a Function fields which a on_change_with method as getter so it can change the value dynamically.

Yes for that you must use a suffix tag inside the field tag, see Views — trytond latest documentation

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