Odoo Help


How to get price of a product from price list

Simon Lee
on 5/2/16, 7:45 AM 1,377 views

I am using price lists for the sales price of the products in my odoo set up. The price lists are working. Now, when opening a product form, I would like to show the "Sale Price" (list_price) of the product by getting it through my price lists so that when I update my sales price lists, the "Sale Price" field in the product form will automatically show the updated sales price (getting from the updated price lists). I cannot figure out how to do it.

Here's the code I tried:

from openerp import models, fields, api
from addons.decimal_precision import decimal_precision as dp
class my_product_template(models.Model):
    def _set_sales_price(self):
         self.list_price = [not sure how to write this part???]
    list_price=fields.Float('Sale Price', compute='_set_sales_price', digits_compute=dp.get_precision('Product Price'),
            help="Base price to compute the customer price. Sometimes called the catalog price.")

i have the following questions:

1) Is the above the right way to overwrite an existing field (list_price) in product.template?

2) Please advise how to write the part [not sure how to write this part???]. I tried to find how to do this in odoo's source code and found something like


but cannot figure out what I should put for the parameters when calling price_get.

Thank you.

Simon Lee



About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/2/16, 7:45 AM
Seen: 1377 times
Last updated: 5/2/16, 8:17 AM