|
@@ -93,6 +93,7 @@ class product_template(models.Model):
|
|
|
return {
|
|
|
'id': self.id,
|
|
|
'company_id': self.company_id.id,
|
|
|
+ '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,
|
|
|
'ean13': self.ean13 if self.ean13 else None,
|
|
@@ -109,3 +110,57 @@ class product_template(models.Model):
|
|
|
'website_published': self.website_published,
|
|
|
'create_date': self.create_date
|
|
|
}
|
|
|
+
|
|
|
+'''
|
|
|
+'''
|
|
|
+class product_attribute_line(models.Model):
|
|
|
+ _inherit = 'product.attribute.line'
|
|
|
+
|
|
|
+ def dump(self):
|
|
|
+ return {
|
|
|
+ 'attribute_id': self.attribute_id if self.attribute_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 []
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+'''
|
|
|
+'''
|
|
|
+class product_attribute_value(models.Model):
|
|
|
+ _inherit = 'product.attribute.value'
|
|
|
+
|
|
|
+ def dump(self):
|
|
|
+ return {
|
|
|
+ 'attribute_id': self.attribute_id if self.attribute_id else None,
|
|
|
+ 'color': self.color,
|
|
|
+ 'create_date': self.create_date,
|
|
|
+ 'display_name': self.display_name,
|
|
|
+ 'id': self.id,
|
|
|
+ 'name': self.name,
|
|
|
+ 'price_extra': self.price_extra,
|
|
|
+ 'price_ids': [price.id for price in self.price_ids] if self.price_ids else [],
|
|
|
+ 'product_ids': [product.id for product in self.product_ids] if self.product_ids else []
|
|
|
+ }
|
|
|
+
|
|
|
+'''
|
|
|
+'''
|
|
|
+class product_product(models.Model):
|
|
|
+ _inherit = 'product.product'
|
|
|
+
|
|
|
+ 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,
|
|
|
+ 'display_name': self.display_name,
|
|
|
+ 'ean13': self.ean13,
|
|
|
+ 'id': self.id,
|
|
|
+ 'is_product_variant': self.is_product_variant,
|
|
|
+ 'list_price': self.list_price,
|
|
|
+ 'name': self.name,
|
|
|
+ 'price': self.price,
|
|
|
+ 'price_extra': self.price_extra
|
|
|
+ }
|