Odoo Help


This community 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.


How to get price of a product from price list

Simon Lee
on 5/2/16, 7:45 AM 290 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



Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


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