تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
5663 أدوات العرض

Hi,

In sale order line and in purchase order line when I change product quantity, product price (unit price) automatically set to 0. I am not getting why this is happening. 

Could anyone help me to achieve this.

Thank you in advance!

الصورة الرمزية
إهمال
أفضل إجابة

Hi bro, 

You can solve this problem by following these steps:

  1. Create a new class that inherits from purchase.order.line. 

  2. Copy and paste the code down below inside the inherited class. 

  3. Vote positif :). 

The code:

@api.onchange('product_qty', 'product_uom') 
def _onchange_quantity(self):
    price = self.unit_price
    sup = super(purchaseOrderLine,self)._onchange_quantity()
    self.unit_price=price
    return sup


الصورة الرمزية
إهمال
الكاتب

Thank you , it works for me!

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
ديسمبر 23
15041
0
أكتوبر 23
33
3
أكتوبر 23
790
1
أكتوبر 23
569
1
أغسطس 23
2629