Odoo Help


tree colors in a view contains a statusbar ??

kais dkhili
on 5/31/14, 11:05 AM 2,401 views

I want to create a tree viewww with colors for each states but the following errors is occured :

Uncaught Error: QWeb2 - template['ListView.rows']: Runtime Error: Error: QWeb2 - template['ListView.row']: Runtime Error: Error: NameError: name 'state' is not defined

this is my XML code:

                        <button string="Confirmer Programme" name="button_confirm" states="draft" type="object" class="oe_highlight" groups="base.group_user"/>
                        <button string="Gagner Programme" name="button_done" states="confirm" type="object" class="oe_highlight" groups="base.group_user"/>
                        <button string="Unconfirmer Programme" name="button_draft" states="cancel,done" type="object" groups="base.group_user"/>
                        <button string="Annuler Programme" name="button_cancel" states="draft,confirm" type="object" groups="base.group_user"/>
                        <field name="state" widget="statusbar" statusbar_visible="draft,confirm,done" statusbar_colors='{"draft":"blue"}'/>

this is my tree view

<record model="ir.ui.view" id="programme_tree">
        <field name="name">programme.tree</field>
        <field name="model">programme</field>
        <field name="type">tree</field> 
        <field name="arch" type="xml">
            <tree colors="blue:state == 'draft';red:state =='confirm';gray:state == 'cancel'" string="Formulaire programme" >
                <field name="date_fin"/>
                <field name="date_resultat"/>
                <field name="nb__notif"/>
                <field name="prog_condition"/>

Please someone help me


Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 6/1/14, 3:38 AM

Did u defined state as selection field in your py file?

'state' : fields.selection([('draft','Draft'),('confirm','Confirm'),('cancel','Cancel')],'State?'),

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/31/14, 11:05 AM
Seen: 2401 times
Last updated: 3/16/15, 8:10 AM