Ir al contenido
Menú
Se marcó esta pregunta
6 Respuestas
9542 Vistas

Hello community, i'm trying to change the default color in a sale order line in my custom module.

i'm trying with this approach but this didn't work :(

    <record id="view_order_form_inherit" model="ir.ui.view">
    <field name="name">sale.form.inherit</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="arch" type="xml">
        <data>
            <tree position="attributes">
                <attribute name="colors">red:state='draft'</attribute>
            </tree>     
        </data>
    </field>
</record>
Avatar
Descartar
Mejor respuesta

Hi,

take this code :

<openerp>
    <data>
        <record id="view_order_tree_inherit" model="ir.ui.view">
            <field name="name">sale.tree.inherit</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_quotation_tree" />  
              <field name="arch" type="xml">                 
                    <tree position="attributes">
                        <attribute name="colors">red:state=='draft'</attribute>
                    </tree>          
            </field>
        </record>
    </data>
</openerp>

This code mark color line in red if state='draft'

thanks.

Avatar
Descartar
Autor

i updated the module but this didn't work

i edit my answer

Autor

Hi Borni, I tried your code, and it does not work. I met some discussion on this topic. most of the people say that this method does not work, replace the old <tree> by another new. you've got an idea

before I posted this code i tested and it works well. in list view quotation it displays red lines when state=draft.

Mejor respuesta

hi in the older version it's like this:

<record id="view_order_form_inherit" model="ir.ui.view">
      <field name="name">sale.form.inherit</field>
      <field name="model">sale.order</field>

      <field name="type">tree</field>

      <field name="arch" type="xml">
           <tree colors = "black:state== 'draft';red:state == 'done' >
        
           <field name="field name" > </field>

          </tree>    

     </field>

</record>
 in this code color line black in draft state and red in done state


Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
abr 17
10626
1
mar 15
4976
2
abr 25
9400
2
ene 25
3120
1
jul 24
2807