summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-05-09 14:16:06 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-05-09 14:16:06 +0700
commit71a71340d9dd73071b24adea5435cac8f41c5fd1 (patch)
treeed770582cee9b80b990cee59fb03e3f21de7f702
parent15f5e97dee95aaaf8917692cb78af73dffc06dc4 (diff)
bug fix error adding field msg for input solr
-rw-r--r--indoteknik_custom/models/apache_solr.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/indoteknik_custom/models/apache_solr.py b/indoteknik_custom/models/apache_solr.py
index bea9b0c5..f003e763 100644
--- a/indoteknik_custom/models/apache_solr.py
+++ b/indoteknik_custom/models/apache_solr.py
@@ -7,7 +7,7 @@ import time
_logger = logging.getLogger(__name__)
_solr = pysolr.Solr('http://10.148.0.5:8983/solr/product/', always_commit=True, timeout=30)
-# _solr = pysolr.Solr('http://34.101.189.218:8983/solr/products/', always_commit=True, timeout=30) # for development only
+# _solr = pysolr.Solr('http://34.101.189.218:8983/solr/product/', always_commit=True, timeout=30) # for development only
class ApacheSolr(models.Model):
@@ -26,7 +26,7 @@ class ApacheSolr(models.Model):
stocks = self.env['stock.vendor'].search(query, limit=limit)
documents = []
for stock in stocks:
- stock_total = float(stock.product_variant_id.product_tmpl_id.qty_stock_vendor)
+ stock_total = int(stock.product_variant_id.product_tmpl_id.qty_stock_vendor)
dict_stock = dict({"set": stock_total})
document = {
"id": int(stock.product_variant_id.product_tmpl_id.id),
@@ -54,7 +54,7 @@ class ApacheSolr(models.Model):
templates = self.env['product.template'].search(query, limit=limit)
documents=[]
for template in templates:
- rating = float(template.virtual_rating)
+ rating = int(template.virtual_rating)
dict_rating = dict({"set":rating})
document = {
"id": template.id,
@@ -63,6 +63,7 @@ class ApacheSolr(models.Model):
documents.append(document)
template.last_calculate_rating = current_time
_logger.info("[SYNC_PRODUCT_RATING_TO_SOLR] Success Set to solr product %s" % template.id)
+ _logger.info(documents)
_solr.add(documents)
def _sync_product_to_solr(self, limit=500):