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 in a view contains a statusbar ??

By
kais dkhili
on 5/31/14, 11:05 AM 1,630 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:

 <header>
                        <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"}'/>
                    </header>

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"/>
            </tree>
        </field>
    </record>

Please someone help me

3

Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
3577
| 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?'),

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: 5/31/14, 11:05 AM
Seen: 1630 times
Last updated: 3/16/15, 8:10 AM