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):
_name='product.template'
_inherit='product.template'
@api.one
@api.depends('list_price')
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
self.pool.get('product.pricelist').price_get(...)
but cannot figure out what I should put for the parameters when calling price_get.
Thank you.
Simon Lee
}