From 8793cf3b8dea2c87024b4c9f49077cc8c6b982d8 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 25 Sep 2024 10:08:00 +0700 Subject: cr stock_total_f --- indoteknik_custom/models/solr/apache_solr.py | 6 +++--- indoteknik_custom/models/solr/product_product.py | 2 +- indoteknik_custom/models/solr/product_template.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indoteknik_custom/models/solr') diff --git a/indoteknik_custom/models/solr/apache_solr.py b/indoteknik_custom/models/solr/apache_solr.py index 6560c9b5..f6b29cd8 100644 --- a/indoteknik_custom/models/solr/apache_solr.py +++ b/indoteknik_custom/models/solr/apache_solr.py @@ -70,7 +70,7 @@ class ApacheSolr(models.Model): stocks = self.env['stock.vendor'].search(query, limit=limit) documents = [] for stock in stocks: - stock_total = int(stock.product_variant_id.product_tmpl_id.qty_stock_vendor) + stock_total = int(stock.product_variant_id.product_tmpl_id.qty_available_bandengan) # dict_stock = dict({"set": stock_total}) document = { "id": int(stock.product_variant_id.product_tmpl_id.id), @@ -178,7 +178,7 @@ class ApacheSolr(models.Model): 'price_discount_f': price_excl_after_disc, 'tax_f': tax, 'variant_total_i': template.product_variant_count, - 'stock_total_f': template.qty_stock_vendor, + 'stock_total_f': template.qty_available_bandengan, 'weight_f': template.weight, 'manufacture_id_i': template.x_manufacture.id or 0, 'manufacture_name_s': template.x_manufacture.x_name or '', @@ -264,7 +264,7 @@ class ApacheSolr(models.Model): 'discount_f': discount, 'price_discount_f': price_excl_after_disc, 'tax_f': tax, - 'stock_total_f': variant.qty_stock_vendor, + 'stock_total_f': variant.qty_available_bandengan, 'weight_f': variant.product_tmpl_id.weight, 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0, 'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '', diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py index 35e3a4b3..6864041e 100644 --- a/indoteknik_custom/models/solr/product_product.py +++ b/indoteknik_custom/models/solr/product_product.py @@ -58,7 +58,7 @@ class ProductProduct(models.Model): 'product_id_i': variant.id, 'template_id_i': variant.product_tmpl_id.id, 'image_s': ir_attachment.api_image('product.template', 'image_512', variant.product_tmpl_id.id), - 'stock_total_f': variant.qty_stock_vendor, + 'stock_total_f': variant.qty_available_bandengan, 'weight_f': variant.weight, 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0, 'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '', diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index d8dec47c..9cb27c5b 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -92,7 +92,7 @@ class ProductTemplate(models.Model): "product_id_i": template.id, "image_s": self.env['ir.attachment'].api_image('product.template', 'image_512', template.id), "variant_total_i": template.product_variant_count, - "stock_total_f": template.qty_stock_vendor, + "stock_total_f": template.qty_available_bandengan, "weight_f": template.weight, "manufacture_id_i": template.x_manufacture.id or 0, "manufacture_name_s": template.x_manufacture.x_name or '', -- cgit v1.2.3 From 41b8281f9e01d675d0078bbe131e41acc9a8c15a Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 25 Sep 2024 10:36:21 +0700 Subject: fix error --- indoteknik_custom/models/solr/apache_solr.py | 4 ++-- indoteknik_custom/models/solr/product_template.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indoteknik_custom/models/solr') diff --git a/indoteknik_custom/models/solr/apache_solr.py b/indoteknik_custom/models/solr/apache_solr.py index f6b29cd8..f04b5e84 100644 --- a/indoteknik_custom/models/solr/apache_solr.py +++ b/indoteknik_custom/models/solr/apache_solr.py @@ -70,7 +70,7 @@ class ApacheSolr(models.Model): stocks = self.env['stock.vendor'].search(query, limit=limit) documents = [] for stock in stocks: - stock_total = int(stock.product_variant_id.product_tmpl_id.qty_available_bandengan) + 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), @@ -178,7 +178,7 @@ class ApacheSolr(models.Model): 'price_discount_f': price_excl_after_disc, 'tax_f': tax, 'variant_total_i': template.product_variant_count, - 'stock_total_f': template.qty_available_bandengan, + 'stock_total_f': template.qty_stock_vendor, 'weight_f': template.weight, 'manufacture_id_i': template.x_manufacture.id or 0, 'manufacture_name_s': template.x_manufacture.x_name or '', diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 9cb27c5b..d8dec47c 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -92,7 +92,7 @@ class ProductTemplate(models.Model): "product_id_i": template.id, "image_s": self.env['ir.attachment'].api_image('product.template', 'image_512', template.id), "variant_total_i": template.product_variant_count, - "stock_total_f": template.qty_available_bandengan, + "stock_total_f": template.qty_stock_vendor, "weight_f": template.weight, "manufacture_id_i": template.x_manufacture.id or 0, "manufacture_name_s": template.x_manufacture.x_name or '', -- cgit v1.2.3 From 30efa28bf211ffefc181551df026047143939b4f Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 25 Sep 2024 11:32:20 +0700 Subject: solr fix --- indoteknik_custom/models/solr/apache_solr.py | 2 +- indoteknik_custom/models/solr/product_product.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/solr') diff --git a/indoteknik_custom/models/solr/apache_solr.py b/indoteknik_custom/models/solr/apache_solr.py index f04b5e84..6560c9b5 100644 --- a/indoteknik_custom/models/solr/apache_solr.py +++ b/indoteknik_custom/models/solr/apache_solr.py @@ -264,7 +264,7 @@ class ApacheSolr(models.Model): 'discount_f': discount, 'price_discount_f': price_excl_after_disc, 'tax_f': tax, - 'stock_total_f': variant.qty_available_bandengan, + 'stock_total_f': variant.qty_stock_vendor, 'weight_f': variant.product_tmpl_id.weight, 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0, 'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '', diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py index 6864041e..35e3a4b3 100644 --- a/indoteknik_custom/models/solr/product_product.py +++ b/indoteknik_custom/models/solr/product_product.py @@ -58,7 +58,7 @@ class ProductProduct(models.Model): 'product_id_i': variant.id, 'template_id_i': variant.product_tmpl_id.id, 'image_s': ir_attachment.api_image('product.template', 'image_512', variant.product_tmpl_id.id), - 'stock_total_f': variant.qty_available_bandengan, + 'stock_total_f': variant.qty_stock_vendor, 'weight_f': variant.weight, 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0, 'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '', -- cgit v1.2.3 From 6c7c80b9cf3f4146af1fcfc4c9b24881a7b29b3c Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 25 Sep 2024 14:39:16 +0700 Subject: add price_tier to program line --- indoteknik_custom/models/solr/product_template.py | 4 ++-- indoteknik_custom/models/solr/promotion_program_line.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/solr') diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index d8dec47c..1eb6f31b 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -112,8 +112,8 @@ class ProductTemplate(models.Model): "description_clean_t": cleaned_desc or '', 'has_product_info_b': True, 'publish_b': not template.unpublished, - 'sni_b': template.unpublished, - 'tkdn_b': template.unpublished, + 'sni_b': template.sni, + 'tkdn_b': template.tkdn, "qty_sold_f": template.qty_sold, "is_in_bu_b": is_in_bu, "voucher_min_purchase_f" : voucher.min_purchase_amount or 0, diff --git a/indoteknik_custom/models/solr/promotion_program_line.py b/indoteknik_custom/models/solr/promotion_program_line.py index 3e3a2a28..64ad4209 100644 --- a/indoteknik_custom/models/solr/promotion_program_line.py +++ b/indoteknik_custom/models/solr/promotion_program_line.py @@ -53,6 +53,11 @@ class PromotionProgramLine(models.Model): 'package_limit_user_i': rec.package_limit_user, 'package_limit_trx_i': rec.package_limit_trx, 'price_f': rec.price, + 'price_tier_1_f': rec.price_tier_1, + 'price_tier_2_f': rec.price_tier_2, + 'price_tier_3_f': rec.price_tier_3, + 'price_tier_4_f': rec.price_tier_4, + 'price_tier_5_f': rec.price_tier_5, 'sequence_i': sequence_value, 'product_ids': [x.product_id.id for x in rec.product_ids], 'products_s': json.dumps(products), -- cgit v1.2.3