models.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, api
  3. class ProductPriceList(models.Model):
  4. _inherit = 'product.pricelist'
  5. @api.model
  6. def getProductPriceList(self,domain):
  7. ProductPriceList = self.env['product.pricelist'].search(domain)
  8. values = []
  9. for pricelist in ProductPriceList:
  10. version_ids = map(lambda x: x.id, pricelist.version_id)
  11. versionIDS = []
  12. for item in self.env['product.pricelist'].search([('id', 'in', version_ids)]):
  13. versionIDS.append(item.id)
  14. values.append({
  15. 'id' : pricelist.id,
  16. 'name' : pricelist.name,
  17. 'type' : pricelist.type,
  18. 'version_id' : versionIDS,
  19. 'store_id' : {
  20. 'id' : pricelist.store_id.id,
  21. 'name' : pricelist.store_id.name,
  22. },
  23. 'currency_id' : {
  24. 'id' : pricelist.currency_id.id,
  25. 'name' : pricelist.currency_id.name,
  26. 'rate_silent': pricelist.currency_id.rate_silent,
  27. 'local_name':pricelist.currency_id.local_name
  28. },
  29. })
  30. return values