Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions web_tree_dynamic_colored_field/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,24 @@ Example:
the options doesn't follow the JSON format, the options string will be
evaluated using py.eval()**

- You can use another field's label referring to a color too... In the
tree view declaration, put
``options="{'fg_color': 'my_other_color_field'}"`` attribute in the
``field`` tag:

::

...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="my_other_color_field" column_invisible="True"/>
<field name="name" options="{'fg_color': 'my_other_color_field'}"/>
...
</tree>
</field>
...

Known issues / Roadmap
======================

Expand Down
15 changes: 15 additions & 0 deletions web_tree_dynamic_colored_field/readme/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,18 @@ Example:
**Note that you can use single or normal quotes. If the declaration of
the options doesn't follow the JSON format, the options string will be
evaluated using py.eval()**

- You can use another field's label referring to a color too... In the tree view declaration, put
`options="{'fg_color': 'my_other_color_field'}"`
attribute in the `field` tag:

...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="my_other_color_field" column_invisible="True"/>
<field name="name" options="{'fg_color': 'my_other_color_field'}"/>
...
</tree>
</field>
...
19 changes: 19 additions & 0 deletions web_tree_dynamic_colored_field/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,25 @@ <h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
<p><strong>Note that you can use single or normal quotes. If the declaration of
the options doesn’t follow the JSON format, the options string will be
evaluated using py.eval()</strong></p>
<ul>
<li><p class="first">You can use another field’s label referring to a color too… In the
tree view declaration, put
<tt class="docutils literal"><span class="pre">options=&quot;{'fg_color':</span> <span class="pre">'my_other_color_field'}&quot;</span></tt> attribute in the
<tt class="docutils literal">field</tt> tag:</p>
<pre class="literal-block">
...
&lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;
&lt;tree string=&quot;View name&quot;&gt;
...
&lt;field name=&quot;my_other_color_field&quot; column_invisible=&quot;True&quot;/&gt;
&lt;field name=&quot;name&quot; options=&quot;{'fg_color': 'my_other_color_field'}&quot;/&gt;
...
&lt;/tree&gt;
&lt;/field&gt;
...
</pre>
</li>
</ul>
</div>
<div class="section" id="known-issues-roadmap">
<h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ patch(ListRenderer.prototype, {
}
}
}
// 'definition' can be a field's label referring to a color
if (definition in record.data && record.data[definition]) {
result = record.data[definition];
}

return result || undefined;
}
},
Expand Down