Skip to Content
Menú
This question has been flagged
7 Respostes
4739 Vistes

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
Best Answer

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?

Related Posts Respostes Vistes Activitat
1
de març 23
2344
3
d’ag. 19
12755
0
de juny 19
3112
0
de març 19
5229
2
de set. 18
3172