İçereği Atla
Menü
Bu soru işaretlendi
8 Cevaplar
12942 Görünümler

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>
Avatar
Vazgeç

Where you want to apply color in tree view?

En İyi Yanıt

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

Avatar
Vazgeç
Üretici

Not working, is odoo 9

These are also supported in 9.

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

Üretici

In a tree view

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

En İyi Yanıt

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/

Avatar
Vazgeç
En İyi Yanıt

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.

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
5
Ağu 24
47745
2
Nis 24
3228
3
Haz 23
7274
2
Haz 23
5523
3
Mar 23
10961