Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3871 Vizualizări

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)

}



Imagine profil
Abandonează
Cel mai bun răspuns

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)

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
dec. 23
1130
0
mar. 15
4275
2
iul. 23
1677
0
ian. 23
1216
2
oct. 16
5735