Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

tree colors not working on Product Tree view V8

By
Roland Lautenbach
on 1/16/15, 7:15 AM 913 views

Has anyone been able to get the color attribute to work on the Product Tree View ?  According to the code below , a product with a virtual_available < 0 should be in 'red' - it doesn't appear to be.

The code in ../addons/stock/product_view.xml looks like this -


<record id="view_stock_product_template_tree" model="ir.ui.view">
            <field name="name">product.template.stock.tree.inherit</field>
            <field name="model">product.template</field>
            <field name="inherit_id" ref="product.product_template_tree_view"/>
            <field name="arch" type="xml">
                <tree position="attributes">                                              
                     <attribute name="colors">{'red':virtual_available&lt;=0, 'blue':virtual_available&gt;=0 and state in ('draft', 'end', 'obsolete'), 'black':virtual_available&gt;=0 and state not in ('draft', 'end', 'obsolete')}</attribute>-->
                </tree> 
                <field name="uom_id" position="after">
                    <field name="qty_available"/>
                    <field name="virtual_available"/>
                </field>
            </field>
        </record>

 

Problem Solved - see zbik answer

I-Soft Solutions, Roland Lautenbach
on 1/16/15, 8:08 AM
0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 1/16/15, 7:28 AM

It may have something to do with the fact that qty_available and virtual_available are function fields that are not stored (with a good reason) and does not have fnct_search implemented (due to complexity).  Try using other fields and see if it works.

0

zbik

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 1/16/15, 7:31 AM

Update your system. See one of the latest commits: https://github.com/odoo/odoo/commit/e28e01a70f397f9ded4bac1ff060b93bf6072e40

0
Roland Lautenbach
On 1/16/15, 7:46 AM

Thanks Ivan, but that code is the standard Odoo code - not mine. However, if I modify the code as below, it does work, which means that it's possibaly not because virtual_available is a function ? I think it has to do with the { }

<record id="view_stock_product_template_tree" model="ir.ui.view">
            <field name="name">product.template.stock.tree.inherit</field>
            <field name="model">product.template</field>
            <field name="inherit_id" ref="product.product_template_tree_view"/>
            <field name="arch" type="xml">
                <tree position="attributes">
                    <attribute name="colors">red:virtual_available&lt;=0</attribute>
            <!--         <attribute name="colors">{'red':virtual_available&lt;=0, 'blue':virtual_available&gt;=0 and state in ('draft', 'end', 'obsolete'), 'black':virtual_available&gt;=0 and state not in ('draft', 'end', 'obsolete')}</attribute>-->
                </tree> 
                <field name="uom_id" position="after">
                    <field name="qty_available"/>
                    <field name="virtual_available"/>
                </field>
                
                <field name="state" position="replace"/>
            </field>
        </record>

@Roland. Sorry, I am not aware that it is actually Odoo's code. You might want to check what @zbik has mentiond to upgrade your code to the latest commit. The fix seems to echo what you have done, removing the { } and single quotes.

Ivan
on 1/16/15, 7:50 AM
Thanks - zbik's link fixed it - it was a bug in the standard code


Regards
Roland Lautenbach

082 658 1000
<img src="cid:image001.gif@01CFC5CB.632A8E40">







On 16 January 2015 at 14:50, Ivan <niecw@mail.odoo.com> wrote:

@Roland. Sorry, I am not aware that it is actually Odoo's code. You might want to check what @zbik has mentiond to upgrade your code to the latest commit. The fix seems to echo what you have done, removing the { } and single quotes.

--
Ivan
Sent by Odoo Inc. using Odoo about Forum Post tree colors not working on Product Tree view V8 (73283)

I-Soft Solutions, Roland Lautenbach
on 1/16/15, 9:42 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/16/15, 7:15 AM
Seen: 913 times
Last updated: 3/16/15, 8:10 AM