Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
8 Trả lời
13008 Lượt xem

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>
Ảnh đại diện
Huỷ bỏ

Where you want to apply color in tree view?

Câu trả lời hay nhấ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

Ảnh đại diện
Huỷ bỏ
Tác giả

Not working, is odoo 9

These are also supported in 9.

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

Tác giả

In a tree view

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

Câu trả lời hay nhấ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/

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhấ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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
5
thg 8 24
47941
2
thg 4 24
3347
3
thg 6 23
7511
2
thg 6 23
5656
3
thg 3 23
11049