Skip to Content
मेन्यू
This question has been flagged

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
Discard
Best Answer

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
Discard
Related Posts Replies Views Activity
2
दिस॰ 23
1521
0
मार्च 15
4560
2
जुल॰ 23
2065
0
जन॰ 23
1522
2
अक्तू॰ 16
6175