Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
8 Răspunsuri
12921 Vizualizări

My code, but the color does not apply:

<notebook>
    <page name="forecast_records" string="Forecast Records">
        <field name="forecast_product_ids" nolabel="1" context="{'active_rec_id':active_id}" domain="[('period_start_date','=', forecast_filter_id)]" attrs="{'readonly': [('state','in',['done'])]}">
            <tree string="Forecast" editable="top" delete="false" create="false">
                <field name="id" invisible='1'/>
                <field name="product_id" readonly="1"/>
                <field name="prestashop_product_id" readonly="1"/>
                <field name="sales" readonly="1"/>
                <field name="days_unavailable" readonly="1"/>
                <field name="percentage_unavailable" readonly="1"/>
                <field name="forecast_qty"/>
                <field name="onhand_qty" readonly="1"/>
                <field name="available_for_sale" readonly="1"/>
                <field name="incoming_qty" readonly="1"/>
                <field name="outgoing_qty" readonly="1"/>
                <field name="action_qty" readonly="1"/>
                <field name="action_required"/>
                <field name="document_number" readonly="1"/>
                <field name="procurement_id" invisible="1"/>
            </tree>
        </field>
    </page>
</notebook>
Imagine profil
Abandonează

Where you want to apply color in tree view?

Cel mai bun răspuns

Hi Daniel,

This is an sample example which apply colors based on state in the record.

example

<record id="module_tree" model="ir.ui.view">
<field name="name">ir.module.module.tree</field>
<field name="model">ir.module.module</field>
<field name="arch" type="xml">
<tree decoration-info="state=='to upgrade' or state=='to install'" decoration-danger="state=='uninstalled'" decoration-muted="state=='uninstallable'" create="false" string="Apps">
<field name="shortdesc"/>
<field name="name" groups="base.group_no_one"/>
<field name="author"/>
<field name="installed_version"/>
<field name="state"/>
<field name="category_id" invisible="1"/>
</tree>
</field>
</record>

These are some more decoration attribute which could be apply

decoration-bf - shows the line in BOLD
decoration-it - shows the line in ITALICS
decoration-danger - shows the line in LIGHT RED
decoration-info - shows the line in LIGHT BLUE
decoration-muted - shows the line in LIGHT GRAY
decoration-primary - shows the line in LIGHT PURPLE
decoration-success - shows the line in LIGHT GREEN

decoration-warning - shows the line in LIGHT BROWN

Click Here to see the main source of xml definition of decoration.

I hope this might help you to solve your problem

Regards,

Anil

Imagine profil
Abandonează
Autor

Not working, is odoo 9

These are also supported in 9.

@Daniel : May i know how you are applying this?

Autor

In a tree view

try to use colors attribute in tree view. syntax <tree colors="<Hexacode of color1>:<condition1>;<Hexacode of color2>:<condition2>;" >

Cel mai bun răspuns

hi, 

Look this 

https://stackoverflow.com/questions/38654497/colors-in-tree-view-odoo-9-error

https://www.odoo.com/fr_FR/forum/aide-1/question/how-to-change-color-of-line-in-tree-view-55291

https://www.odoo.com/apps/modules/9.0/web_tree_dynamic_colored_field/

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

Try This Example

<tree string="Fleet Reccurring Lines" colors="#0b7a35:payment_info=='paid';#f20b07:payment_info!='paid'">
<field name="date_today"/>
<field name="name"/>
<field name="account_info"/>
<field name="recurring_amount"/>
<field name="payment_info"/>
</tree>

Thank you.

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
5
aug. 24
47735
2
apr. 24
3212
3
iun. 23
7257
2
iun. 23
5515
3
mar. 23
10951