Skip to content

9.0 web tree dynamic colored field - #473

Merged
pedrobaeza merged 10 commits into
OCA:9.0from
hbrunn:9.0-web_tree_dynamic_colored_field
Nov 21, 2016
Merged

pedrobaeza merged 10 commits into
OCA:9.0from
hbrunn:9.0-web_tree_dynamic_colored_field

Conversation

@hbrunn

@hbrunn hbrunn commented Nov 8, 2016

Copy link
Copy Markdown
Member

ping @jbeficent

@hbrunn hbrunn added this to the 9.0 milestone Nov 8, 2016
@pedrobaeza pedrobaeza mentioned this pull request Nov 8, 2016
55 tasks

@JordiBForgeFlow JordiBForgeFlow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add therp

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@JordiBForgeFlow JordiBForgeFlow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, tested all options on a separate module. Works nicely!
image

@pedrobaeza

Copy link
Copy Markdown
Member

@jbeficent, that hurts a bit my view. You should reconsider the abuse of colors in tree views...

@JordiBForgeFlow

Copy link
Copy Markdown
Member

@pedrobaeza haha! well, I put all lines in red, just to test color_field :)

@pedrobaeza

Copy link
Copy Markdown
Member

Ah, OK then...

@AaronHForgeFlow

Copy link
Copy Markdown
Contributor

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"'

@AaronHForgeFlow

Copy link
Copy Markdown
Contributor

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 AaronHForgeFlow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on runbot 👍

@susport susport left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pedrobaeza
pedrobaeza merged commit 27c6002 into OCA:9.0 Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants