|  | @@ -1,5 +1,6 @@
 | 
	
		
			
				|  |  |  # -*- coding: utf-8 -*-
 | 
	
		
			
				|  |  |  from openerp import models, fields
 | 
	
		
			
				|  |  | +import inspect
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  '''
 | 
	
		
			
				|  |  |      Users class with token field for manage authentication
 | 
	
	
		
			
				|  | @@ -91,24 +92,36 @@ class product_template(models.Model):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      def dump(self):
 | 
	
		
			
				|  |  |          return {
 | 
	
		
			
				|  |  | -            'id': self.id,
 | 
	
		
			
				|  |  | -            'company_id': self.company_id.id if self.company_id.id else None,
 | 
	
		
			
				|  |  | +            'active': self.active,
 | 
	
		
			
				|  |  | +            'alternative_product_ids': [alt.id for alt in self.alternative_product_ids] if self.alternative_product_ids else [],
 | 
	
		
			
				|  |  |              'attribute_line_ids': [line.id for line in self.attribute_line_ids] if self.attribute_line_ids else [],
 | 
	
		
			
				|  |  | +            'color': self.color,
 | 
	
		
			
				|  |  | +            'company_id': self.company_id.id if self.company_id.id else None,
 | 
	
		
			
				|  |  | +            'categ_id': self.categ_id.id if self.categ_id.id else None,
 | 
	
		
			
				|  |  |              'default_code': self.default_code if self.default_code else None,
 | 
	
		
			
				|  |  |              'description': self.description if self.description else None,
 | 
	
		
			
				|  |  | +            'display_name': self.display_name,
 | 
	
		
			
				|  |  |              'ean13': self.ean13 if self.ean13 else None,
 | 
	
		
			
				|  |  | +            'factory_barcode': self.factory_barcode if self.factory_reference else None,
 | 
	
		
			
				|  |  | +            'factory_reference': self.factory_reference if self.factory_reference else None,
 | 
	
		
			
				|  |  | +            'flip_image': self.flip_image if hasattr(self, 'flip_image') else None,
 | 
	
		
			
				|  |  |              'image_medium': self.image_medium,
 | 
	
		
			
				|  |  |              'image_small': self.image_small,
 | 
	
		
			
				|  |  | -            'name': self.name,
 | 
	
		
			
				|  |  | +            'is_flip_image': self.is_flip_image if hasattr(self, 'is_flip_image') else False,
 | 
	
		
			
				|  |  | +            'is_product_variant': self.is_product_variant,
 | 
	
		
			
				|  |  |              'list_price': self.list_price,
 | 
	
		
			
				|  |  | -            'purchase_ok': self.purchase_ok,
 | 
	
		
			
				|  |  | -            'qty_available': self.qty_available,
 | 
	
		
			
				|  |  | -            'rental': self.rental,
 | 
	
		
			
				|  |  | -            'sale_ok': self.sale_ok,
 | 
	
		
			
				|  |  | -            'standard_price': self.standard_price,
 | 
	
		
			
				|  |  | -            'type': self.type,
 | 
	
		
			
				|  |  | -            'website_published': self.website_published,
 | 
	
		
			
				|  |  | -            'create_date': self.create_date
 | 
	
		
			
				|  |  | +            'mes_type': self.mes_type,
 | 
	
		
			
				|  |  | +            'multiple_image': self.multiple_image if hasattr(self, 'multiple_image') else False,
 | 
	
		
			
				|  |  | +            'name': self.name,
 | 
	
		
			
				|  |  | +            'price': self.price,
 | 
	
		
			
				|  |  | +            'product_variant_count': self.product_variant_count,
 | 
	
		
			
				|  |  | +            'product_variant_ids': [variant.id for variant in self.product_variant_ids] if self.product_variant_ids else [],
 | 
	
		
			
				|  |  | +            'purchase_ok': self.purchase_ok if hasattr(self, 'purchase_ok') else False,
 | 
	
		
			
				|  |  | +            'qty_available': self.qty_available if hasattr(self, 'qty_available') else 0,
 | 
	
		
			
				|  |  | +            'rental': self.rental if hasattr(self, 'rental') else False,
 | 
	
		
			
				|  |  | +            'sale_ok': self.sale_ok if hasattr(self, 'sale_ok') else False,
 | 
	
		
			
				|  |  | +            'type': self.type if hasattr(self, 'type') else None,
 | 
	
		
			
				|  |  | +            'website_published': self.website_published if hasattr(self, 'website_published') else False
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  '''
 | 
	
	
		
			
				|  | @@ -126,6 +139,36 @@ class product_attribute_line(models.Model):
 | 
	
		
			
				|  |  |              'value_ids': [value.id for value in self.value_ids] if self.value_ids else []
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +'''
 | 
	
		
			
				|  |  | +'''
 | 
	
		
			
				|  |  | +class product_attribute(models.Model):
 | 
	
		
			
				|  |  | +    _inherit = 'product.attribute'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    def dump(self):
 | 
	
		
			
				|  |  | +        return {
 | 
	
		
			
				|  |  | +            'active': self.active,
 | 
	
		
			
				|  |  | +            'create_date': self.create_date,
 | 
	
		
			
				|  |  | +            'display_name': self.display_name,
 | 
	
		
			
				|  |  | +            'id': self.id,
 | 
	
		
			
				|  |  | +            'name': self.name,
 | 
	
		
			
				|  |  | +            'type': self.type,
 | 
	
		
			
				|  |  | +            'value_ids': [value.id for value in self.value_ids] if self.value_ids else []
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +'''
 | 
	
		
			
				|  |  | +'''
 | 
	
		
			
				|  |  | +class product_attribute_price(models.Model):
 | 
	
		
			
				|  |  | +    _inherit = 'product.attribute.price'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    def dump(self):
 | 
	
		
			
				|  |  | +        attributes = inspect(self, lambda a:not(isroutine(a)))
 | 
	
		
			
				|  |  | +        print '----------------------------------------------------------------'
 | 
	
		
			
				|  |  | +        print attributes
 | 
	
		
			
				|  |  | +        print '----------------------------------------------------------------'
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        return {
 | 
	
		
			
				|  |  | +            'response': 'ok'
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  '''
 | 
	
		
			
				|  |  |  '''
 | 
	
	
		
			
				|  | @@ -154,13 +197,29 @@ class product_product(models.Model):
 | 
	
		
			
				|  |  |          return {
 | 
	
		
			
				|  |  |              'active': self.active,
 | 
	
		
			
				|  |  |              'alternative_product_ids': [alternative.id for alternative in self.alternative_product_ids] if self.alternative_product_ids else [],
 | 
	
		
			
				|  |  | +            'attribute_line_ids': [alt.id for alt in self.attribute_line_ids] if self.attribute_line_ids else [],
 | 
	
		
			
				|  |  | +            'attribute_value_ids': [value.id for value in self.attribute_value_ids] if self.attribute_value_ids else [],
 | 
	
		
			
				|  |  | +            'categ_id': self.categ_id.id if self.categ_id else None,
 | 
	
		
			
				|  |  | +            'code': self.code,
 | 
	
		
			
				|  |  | +            'company_id': self.company_id.id if self.company_id else None,
 | 
	
		
			
				|  |  | +            'create_date': self.create_date,
 | 
	
		
			
				|  |  | +            'default_code': self.default_code if self.default_code else None,
 | 
	
		
			
				|  |  |              'description': self.description if self.description else None,
 | 
	
		
			
				|  |  |              'display_name': self.display_name,
 | 
	
		
			
				|  |  |              'ean13': self.ean13 if self.ean13 else None,
 | 
	
		
			
				|  |  | +            'factory_barcode': self.factory_barcode if self.factory_barcode else None,
 | 
	
		
			
				|  |  | +            'factory_reference': self.factory_reference if self.factory_reference else None,
 | 
	
		
			
				|  |  | +            'image_medium': self.image_medium,
 | 
	
		
			
				|  |  | +            'image_small': self.image_small,
 | 
	
		
			
				|  |  | +            'image_variant': self.image_variant,
 | 
	
		
			
				|  |  |              'id': self.id,
 | 
	
		
			
				|  |  |              'is_product_variant': self.is_product_variant,
 | 
	
		
			
				|  |  |              'list_price': self.list_price,
 | 
	
		
			
				|  |  |              'name': self.name,
 | 
	
		
			
				|  |  | +            'name_template': self.name_template,
 | 
	
		
			
				|  |  |              'price': self.price,
 | 
	
		
			
				|  |  | -            'price_extra': self.price_extra
 | 
	
		
			
				|  |  | +            'price_extra': self.price_extra,
 | 
	
		
			
				|  |  | +            'product_tmpl_id': self.product_tmpl_id.id if self.product_tmpl_id else None,
 | 
	
		
			
				|  |  | +            'product_variant_count': self.product_variant_count,
 | 
	
		
			
				|  |  | +            'product_variant_ids': [variant.id for variant in self.product_variant_ids] if self.product_variant_ids else []
 | 
	
		
			
				|  |  |          }
 |