models.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, api
  3. class ProductProduct(models.Model):
  4. _inherit = 'product.product'
  5. @api.model
  6. def getProductProductStockAthletic(self,domain):
  7. ProductProduct = self.env['product.product'].search(domain)
  8. values = []
  9. for product in ProductProduct:
  10. attributeValuesLines = map(lambda x: x.id, product.attribute_value_ids)
  11. attributeIDS = []
  12. for arttIds in self.env['product.attribute.value'].search([('id', 'in', attributeValuesLines)]):
  13. attributeIDS.append(arttIds.attribute_id.id)
  14. values.append({
  15. 'id': product.id,
  16. 'display_name': product.display_name,
  17. 'standard_price': product.standard_price,
  18. 'lst_price': product.lst_price,
  19. 'categ_id': {
  20. 'id': product.categ_id.id,
  21. 'name': product.categ_id.name,
  22. 'complete_name': product.categ_id.complete_name,
  23. },
  24. 'atribute_value_ids': attributeValuesLines,
  25. 'attribute_ids': attributeIDS,
  26. 'default_code': product.default_code,
  27. 'factory_reference': product.factory_reference,
  28. 'ean13': product.ean13,
  29. })
  30. return values