Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
3894 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
dec. 23
1135
0
mrt. 15
4281
2
jul. 23
1706
0
jan. 23
1224
2
okt. 16
5752