Skip to Content
Menu
This question has been flagged
7 Replies
3596 Views

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
Discard
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
Discard
Author

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?

Author

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>

Author

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","!=",[]]]

Author

have you ever found it?

Related Posts Replies Views Activity
1
Mar 23
1247
3
Aug 19
11083
0
Jun 19
2243
0
Mar 19
4311
2
Sep 18
2433