1234567891011121314151617181920212223242526272829303132333435 |
- # -*- coding: utf-8 -*-
- from openerp import models, fields, api
- class ProductProduct(models.Model):
- _inherit = 'product.product'
- @api.model
- def getProductProduct(self,domain):
- # import web_pdb; web_pdb.set_trace()
- ProductProduct = self.env['product.product'].search(domain)
- values = []
- for product in ProductProduct:
- # import web_pdb; web_pdb.set_trace()
- attributeValuesLines = map(lambda x: x.id, product.attribute_value_ids)
- attributeIDS = []
- for arttIds in self.env['product.attribute.value'].search([('id', 'in', attributeValuesLines)]):
- attributeIDS.append(arttIds.attribute_id.id)
- values.append({
- 'id': product.id,
- 'name': product.name,
- 'standard_price': product.standard_price,
- 'ean13': product.ean13,
- 'categ_id': {
- 'id': product.categ_id.id,
- 'name': product.categ_id.name,
- 'complete_name': product.categ_id.complete_name,
- },
- 'atribute_value_ids': attributeValuesLines,
- 'attribute_ids': attributeIDS
- })
- return values
|