İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
4352 Görünümler

I'm tring to get price of product based on price list selected , but the error occur , it said not exist :

'price_list':sale.pricelist_id.get_product_price(line.product_id)
AttributeError: 'product.pricelist' object has no attribute 'get_product_price'

This is the code:

sales = self.env['sale.order'].search(domain)

# Convert sales variable to a list of dictionaries
sales_list = []
for sale in sales:
sale_dict = {
'id': sale.id,
'name'
: sale.name,
'list'
: sale.pricelist_id,
'order_line'
: []
}
for line in sale["order_line"]:
line_dict = {
'id': line.id,
'product_id'
: line.product_id.id,
'product_name'
: line.product_id.name,
'original_number'
: line.product_id.original_number,
'price_list'
: sale.pricelist_id.get_product_price(line.product_id)

}



Avatar
Vazgeç
En İyi Yanıt

There was a breaking change from 15.0 to 16.0.


Try to replace:

sale.pricelist_id.get_product_price(line.product_id)

by:

sale.pricelist_id._get_product_price(line.product_id)

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Ara 23
1522
0
Mar 15
4561
2
Tem 23
2066
0
Oca 23
1523
2
Eki 16
6176