Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
7 Odpovědi
4777 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
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 Odpovědi Zobrazení Aktivita
1
bře 23
2392
3
srp 19
12854
0
čvn 19
3180
0
bře 19
5298
2
zář 18
3244