summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-05-10 11:53:40 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-05-10 11:53:40 +0700
commiteecd3809837c8e15b6a7727d57c2f310b983ce28 (patch)
treed892577b9124ab8426fbdbc7afcc0cb1bfded41a
parent8454ff5a6641db8ba283fdc251647e60b96072e3 (diff)
bug fix error msg string while integrate stock to solr
-rw-r--r--indoteknik_custom/models/apache_solr.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/indoteknik_custom/models/apache_solr.py b/indoteknik_custom/models/apache_solr.py
index 86039716..a988a8d3 100644
--- a/indoteknik_custom/models/apache_solr.py
+++ b/indoteknik_custom/models/apache_solr.py
@@ -27,14 +27,14 @@ class ApacheSolr(models.Model):
documents = []
for stock in stocks:
stock_total = int(stock.product_variant_id.product_tmpl_id.qty_stock_vendor)
- dict_stock = dict({"set": stock_total})
+ # dict_stock = dict({"set": stock_total})
document = {
"id": int(stock.product_variant_id.product_tmpl_id.id),
- "stock_total_f": dict_stock
+ "stock_total_f": stock_total
}
documents.append(document)
_logger.info("[SYNC_PRODUCT_STOCK_TO_SOLR] Success Set to solr product %s" % stock.product_variant_id.product_tmpl_id.id)
- _solr.add(documents)
+ _solr.add(documents, fieldUpdates={'stock_total_f':'set'})
def _update_rating_product_to_solr(self, limit=1000):
current_time = datetime.now()