|
@@ -3,7 +3,7 @@ import logging
|
|
|
from openerp import api, fields, models
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
-class eiru_pos(models.Model):
|
|
|
+class EiruPOS(models.Model):
|
|
|
_name = 'eiru.pos'
|
|
|
|
|
|
# Get company
|
|
@@ -33,18 +33,21 @@ class eiru_pos(models.Model):
|
|
|
domain = [('sale_ok', '=', True), ('active', '=', True)]
|
|
|
products = []
|
|
|
|
|
|
+ # map products
|
|
|
for product in self.env['product.template'].search(domain):
|
|
|
variants = []
|
|
|
|
|
|
+ # map variants
|
|
|
for variant in product.product_variant_ids:
|
|
|
if not variant.active:
|
|
|
continue
|
|
|
-
|
|
|
attributes = []
|
|
|
|
|
|
+ # map product attributes
|
|
|
for attribute_line in variant.attribute_line_ids:
|
|
|
values = []
|
|
|
|
|
|
+ # map product attributes values
|
|
|
for value in attribute_line.value_ids:
|
|
|
values.append({
|
|
|
'id': value.id,
|
|
@@ -52,7 +55,6 @@ class eiru_pos(models.Model):
|
|
|
'name': value.name,
|
|
|
'price_extra': value.price_extra
|
|
|
})
|
|
|
-
|
|
|
attributes.append({
|
|
|
'id': attribute_line.id,
|
|
|
'attribute': {
|
|
@@ -61,7 +63,6 @@ class eiru_pos(models.Model):
|
|
|
},
|
|
|
'values': values
|
|
|
})
|
|
|
-
|
|
|
variants.append({
|
|
|
'id': variant.id,
|
|
|
'display_name': variant.display_name,
|
|
@@ -72,7 +73,6 @@ class eiru_pos(models.Model):
|
|
|
'qty_available': variant.qty_available,
|
|
|
'attributes': attributes
|
|
|
})
|
|
|
-
|
|
|
products.append({
|
|
|
'id': product.id,
|
|
|
'display_name': product.display_name,
|
|
@@ -115,7 +115,6 @@ class eiru_pos(models.Model):
|
|
|
'variant_count': product.product_variant_count,
|
|
|
'variants': variants
|
|
|
})
|
|
|
-
|
|
|
return products
|
|
|
|
|
|
# Get all currencies
|