123456789101112131415161718192021222324252627282930 |
- from openerp.http import request as r
- def get_pricelist_id(currency_id):
- if not currency_id:
- return None
- domain = [
- ('active', '=', True),
- ('type', '=', 'sale')
- ]
- pricelist = r.env['product.pricelist'].search(domain)
- if not True in pricelist.mapped(lambda p: p.currency_id.id == currency_id):
- pricelist = pricelist[0].copy()
- pricelist.write({
- 'currency_id': currency_id
- })
- else:
- pricelist = pricelist.filtered(lambda p: p.currency_id.id == currency_id)
- if len(pricelist) > 1:
- pricelist = pricelist[0]
-
-
- return pricelist.id
|