Ir al contenido
Menú
Se marcó esta pregunta
7 Respuestas
4763 Vistas

Hi,

I have to put readonly the unit price of the lines of the sales order but inserting in the  view readonly= "1" it doesn't calculate me the totals and leaves them to 0. How can I solve?

<xpath expr="//tree/field[@name='price_unit']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>


Avatar
Descartar
Mejor respuesta

Readonly field will not store into the Database 

While calculating total, Unit price is zero in your case so it's zero

so we have to pass store=True on python file or  force_save="1" on xml

After this changes it will work

Avatar
Descartar
Autor

You're right it works! Just don't give me an error when I delete the sales order line ... could you tell me why?

Uncaught Error: QWeb2 - template['ListView.rows']: Runtime Error: Error: QWeb2 - template['ListView.row']: Runtime Error: Error: NameError: name 'promo_block' is not defined

Have you added any new field with name promo_block?

Autor

Yes!

record id="sale_promotion_in_sale_order_form" model="ir.ui.view">

<field name="name">sale.order.form.add.promotions</field>

<field name="model">sale.order</field>

<field name="inherit_id" ref="sale.view_order_form" />

<field name="arch" type="xml">

<xpath expr="//field[@name='order_line']/tree//field[@name='price_subtotal']"

position="after">

<field name="promo_block" invisible="1"/>

<field name="promotion_code" readonly="1"/>

</xpath>

<xpath expr="/form/sheet/notebook/page/field[@name='order_line']/tree" position="attributes">

<attribute name="decoration-muted">promo_block</attribute>

</xpath>

</field>

</record>

I think error with the follow line

<xpath expr="/form/sheet/notebook/page/field[@name='order_line']/tree" position="attributes">

<attribute name="decoration-muted">promo_block</attribute>

</xpath>

Autor

I have deleted

<xpath expr="/form/sheet/notebook/page/field[@name='order_line']/tree" position="attributes">

<attribute name="decoration-muted">promo_block</attribute>

</xpath>

but I've this error:

Uncaught Error: Unknown field qty_invoiced in domain ["|",["qty_invoiced",">",0],["procurement_ids","!=",[]]]

Autor

have you ever found it?

Publicaciones relacionadas Respuestas Vistas Actividad
1
mar 23
2367
3
ago 19
12815
0
jun 19
3171
0
mar 19
5278
2
sept 18
3206