Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
4353 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
dic 23
1522
0
mar 15
4561
2
jul 23
2066
0
ene 23
1523
2
oct 16
6176