# -*- coding: utf-8 -*- from openerp.http import request as r def get_pricelist_id(currency_id): 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) return pricelist.id