9.0 web tree dynamic colored field - #473
Conversation
JordiBForgeFlow
left a comment
There was a problem hiding this comment.
Tested on runbot. Works as expected. Could not evaluate the color_field. Not sure how it works. Should it be connected to a field such as "color" that returns "red / black,..." and would paint the whole line accordingly?
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| # | ||
| ############################################################################## | ||
| # © 2015 Camptocamp SA, Damien Crier |
There was a problem hiding this comment.
copyrights in files apply to the author of the file, and we didn't change anything meaningful there
| <field name="inherit_id" ref="base.view_users_tree" /> | ||
| <field name="arch" type="xml"> | ||
| <xpath expr="." position="attributes"> | ||
| <attribute name="color_field">lang</attribute> |
There was a problem hiding this comment.
Is this a valid example? I cannot see how the field 'lang' of the user can change the color of the record. For example, if the language is "EN"(English).
There was a problem hiding this comment.
no, but you can verify it works as intended by inspecting the dom, it will have written the language in the color property of the style attribute. This also answers your previous question: The content of the color_field will stupidly be written into the style attribute. You can even use this to hack the whole thing by returning there red; whatever_other_css_property: some_value
|
@jbeficent, that hurts a bit my view. You should reconsider the abuse of colors in tree views... |
|
@pedrobaeza haha! well, I put all lines in red, just to test |
|
Ah, OK then... |
|
I'm testing on runbot and the color_field attribute works perfectly. However I'm getting errors using fg_color and bg_color attributes. Is this syntax correct?: <field name="display_name" fg_color="yellow"' |
|
The problem was that I was not setting the condition. The correct syntax would be: <field name="display_name" fg_color="yellow:1==1"/ |
AaronHForgeFlow
left a comment
There was a problem hiding this comment.
Tested on runbot 👍

ping @jbeficent