Explorar el Código

bug resuelto en los endpoints

robert2206 hace 8 años
padre
commit
1977e7416b
Se han modificado 3 ficheros con 9 adiciones y 9 borrados
  1. BIN
      controllers/http_handler.pyc
  2. 9 9
      models/models.py
  3. BIN
      models/models.pyc

BIN
controllers/http_handler.pyc


+ 9 - 9
models/models.py

@@ -92,7 +92,7 @@ class product_template(models.Model):
     def dump(self):
         return {
             'id': self.id,
-            'company_id': self.company_id.id,
+            'company_id': self.company_id.id if self.company_id.id else None,
             'attribute_line_ids': [line.id for line in self.attribute_line_ids] if self.attribute_line_ids else [],
             'default_code': self.default_code if self.default_code else None,
             'description': self.description if self.description else None,
@@ -118,12 +118,12 @@ class product_attribute_line(models.Model):
 
     def dump(self):
         return {
-            'attribute_id': self.attribute_id if self.attribute_id else None,
+            'attribute_id': self.attribute_id.id if self.attribute_id.id else None,
             'create_date': self.create_date,
             'display_name': self.display_name,
             'id': self.id,
-            'product_tmpl_id': self.product_tmpl_id,
-            'value_ids': [value.id for value in self.value_ids] if value_ids else []
+            'product_tmpl_id': self.product_tmpl_id.id if self.product_tmpl_id.id else None,
+            'value_ids': [value.id for value in self.value_ids] if self.value_ids else []
         }
 
 
@@ -134,8 +134,8 @@ class product_attribute_value(models.Model):
 
     def dump(self):
         return {
-            'attribute_id': self.attribute_id if self.attribute_id else None,
-            'color': self.color,
+            'attribute_id': self.attribute_id.id if self.attribute_id.id else None,
+            'color': self.color if self.color else None,
             'create_date': self.create_date,
             'display_name': self.display_name,
             'id': self.id,
@@ -153,10 +153,10 @@ class product_product(models.Model):
     def dump(self):
         return {
             'active': self.active,
-            'alternative_product_ids': [alternative.id for alternative in self.alternative_product_ids] if alternative_product_ids else [],
-            'description': self.description,
+            'alternative_product_ids': [alternative.id for alternative in self.alternative_product_ids] if self.alternative_product_ids else [],
+            'description': self.description if self.description else None,
             'display_name': self.display_name,
-            'ean13': self.ean13,
+            'ean13': self.ean13 if self.ean13 else None,
             'id': self.id,
             'is_product_variant': self.is_product_variant,
             'list_price': self.list_price,

BIN
models/models.pyc