summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2026-01-15 08:51:11 +0000
committerIT Fixcomart <it@fixcomart.co.id>2026-01-15 08:51:11 +0000
commit74b5caa2ff4c30c824b243a8c621df590eab90e6 (patch)
treeddb84b050e1f4430ab3458851bbdcc5e1d2ae6dd
parentfe5b09c1aa98723a3e0a3cf8174d6bc688c21bae (diff)
parent25baecd1038b6b629e96d8b9eb9651bec95050b3 (diff)
Merged in magento-solr-v1 (pull request #474)
Magento solr v1
-rwxr-xr-xindoteknik_custom/models/product_template.py15
-rw-r--r--indoteknik_custom/models/solr/apache_solr.py7
-rw-r--r--indoteknik_custom/models/solr/product_product.py4
-rw-r--r--indoteknik_custom/models/solr/product_template.py2
-rw-r--r--indoteknik_custom/views/product_product.xml1
-rwxr-xr-xindoteknik_custom/views/product_template.xml5
6 files changed, 32 insertions, 2 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index ee33a185..5730b08b 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -15,7 +15,17 @@ _logger = logging.getLogger(__name__)
class ProductTemplate(models.Model):
_inherit = "product.template"
-
+ x_attribute_set_id = fields.Integer(
+ string="Magento Attribute Set ID",
+ default=0,
+ index=True,
+ help="Attribute Set ID dari Magento"
+ )
+ x_attribute_set_name = fields.Char(
+ string="Magento Attribute Set Name",
+ help="Attribute Set Name dari Magento"
+ )
+
image_carousel_lines = fields.One2many(
comodel_name="image.carousel",
inverse_name="product_id",
@@ -74,7 +84,6 @@ class ProductTemplate(models.Model):
merchandise_ok = fields.Boolean(string='Product Promotion')
print_barcode = fields.Boolean(string='Print Barcode', default=True)
# qr_code = fields.Binary("QR Code", compute='_compute_qr_code')
- # has_magento = fields.Boolean(string='Has Magento?', default=False)
@api.model
def create(self, vals):
@@ -930,6 +939,8 @@ class ProductProduct(models.Model):
qty_pcs_box = fields.Float("Pcs Box")
barcode_box = fields.Char("Barcode Box")
+ has_magento = fields.Boolean(string='Has Magento?', default=False)
+
def generate_product_sla(self):
product_variant_ids = self.env.context.get('active_ids', [])
product_variant = self.search([('id', 'in', product_variant_ids)])
diff --git a/indoteknik_custom/models/solr/apache_solr.py b/indoteknik_custom/models/solr/apache_solr.py
index d111c1c1..21fb15d2 100644
--- a/indoteknik_custom/models/solr/apache_solr.py
+++ b/indoteknik_custom/models/solr/apache_solr.py
@@ -10,6 +10,9 @@ _logger = logging.getLogger(__name__)
_solr = pysolr.Solr('http://10.148.0.5:8983/solr/product/', always_commit=True, timeout=30)
_variants_solr = pysolr.Solr('http://10.148.0.5:8983/solr/variants/', always_commit=True, timeout=30)
_recommendation_solr = pysolr.Solr('http://10.148.0.5:8983/solr/recommendation/', always_commit=True, timeout=30)
+# _solr = pysolr.Solr('http://35.219.88.139/solr/product/', always_commit=True, timeout=30)
+# _variants_solr = pysolr.Solr('http://35.219.88.139/solr/variants/', always_commit=True, timeout=30)
+# _recommendation_solr = pysolr.Solr('http://35.219.88.139/solr/recommendation/', always_commit=True, timeout=30)
# _solr = pysolr.Solr('http://34.101.189.218:8983/solr/product/', always_commit=True, timeout=30) # for development only
@@ -255,6 +258,7 @@ class ApacheSolr(models.Model):
'id': variant.id,
'display_name_s': variant.display_name,
'name_s': variant.name,
+ 'search_keywords_t': variant.display_name,
'default_code_s': variant.default_code or '',
'product_rating_f': variant.product_tmpl_id.virtual_rating,
'product_id_i': variant.id,
@@ -266,6 +270,9 @@ class ApacheSolr(models.Model):
'tax_f': tax,
'stock_total_f': variant.qty_stock_vendor,
'weight_f': variant.product_tmpl_id.weight,
+ 'has_magento_b': variant.has_magento,
+ 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0,
+ 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '',
'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0,
'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '',
'manufacture_name': 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 7260c3ca..a90bcb98 100644
--- a/indoteknik_custom/models/solr/product_product.py
+++ b/indoteknik_custom/models/solr/product_product.py
@@ -64,6 +64,7 @@ class ProductProduct(models.Model):
'id': variant.id,
'display_name_s': variant.display_name,
'name_s': variant.name,
+ 'search_keywords_t': variant.display_name,
'default_code_s': variant.default_code or '',
'product_rating_f': variant.product_tmpl_id.virtual_rating,
'product_id_i': variant.id,
@@ -73,6 +74,9 @@ class ProductProduct(models.Model):
'image_mobile_s': ir_attachment.api_image('product.template', 'image_256', variant.product_tmpl_id.id),
'stock_total_f': variant.qty_free_bandengan,
'weight_f': variant.weight,
+ 'has_magento_b': variant.has_magento,
+ 'attribute_set_id_i': variant.product_tmpl_id.x_attribute_set_id or 0,
+ 'attribute_set_name_s': variant.product_tmpl_id.x_attribute_set_name or '',
'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0,
'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '',
'manufacture_name': 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 a7beca12..d6ca9097 100644
--- a/indoteknik_custom/models/solr/product_template.py
+++ b/indoteknik_custom/models/solr/product_template.py
@@ -105,6 +105,8 @@ class ProductTemplate(models.Model):
"variant_total_i": template.product_variant_count,
"stock_total_f": template.qty_stock_vendor,
"weight_f": template.weight,
+ # "attribute_set_id_i": template.x_attribute_set_id or 0,
+ # "attribute_set_name_s": template.x_attribute_set_name or '',
"manufacture_id_i": template.x_manufacture.id or 0,
"manufacture_name_s": template.x_manufacture.x_name or '',
"manufacture_name": template.x_manufacture.x_name or '',
diff --git a/indoteknik_custom/views/product_product.xml b/indoteknik_custom/views/product_product.xml
index 1d04e708..e8a7380b 100644
--- a/indoteknik_custom/views/product_product.xml
+++ b/indoteknik_custom/views/product_product.xml
@@ -20,6 +20,7 @@
<field name="qty_free_bandengan" optional="hide"/>
<field name="qty_rpo" optional="hide"/>
<field name="plafon_qty" optional="hide"/>
+ <field name="has_magento" optional="hide"/>
</field>
</field>
</record>
diff --git a/indoteknik_custom/views/product_template.xml b/indoteknik_custom/views/product_template.xml
index 177449f4..9fbf007a 100755
--- a/indoteknik_custom/views/product_template.xml
+++ b/indoteknik_custom/views/product_template.xml
@@ -78,6 +78,7 @@
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<field name="last_update_solr" position="after">
+ <field name="has_magento"/>
<field name="barcode_box" />
<field name="qty_pcs_box" />
<field name="clean_website_description" />
@@ -112,6 +113,9 @@
<field name="virtual_rating"/>
<field name="search_rank"/>
<field name="solr_flag"/>
+ <field name="x_attribute_set_id"/>
+ <field name="x_attribute_set_name"/>
+ <!-- <field name="has_magento"/> -->
</field>
</field>
</record>
@@ -125,6 +129,7 @@
<field name="usage"/>
<field name="specification"/>
<field name="material"/>
+ <field name="has_magento" />
</field>
</field>
</record>