Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
7 Replies
4776 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Penulis

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?

Penulis

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>

Penulis

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

Penulis

have you ever found it?

Post Terkait Replies Tampilan Aktivitas
1
Mar 23
2391
3
Agu 19
12848
0
Jun 19
3180
0
Mar 19
5297
2
Sep 18
3243