summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-10-18 10:04:57 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-10-18 10:04:57 +0700
commitc70cca235282dc01134f105a2c45fc071f09ae9e (patch)
tree5325cc36c2dae09b5756d31a49d05be8de2269d7
parentff9f2f59d1042acaea778049333f1db114a431cb (diff)
Fix sync active product solr
-rw-r--r--indoteknik_custom/models/solr/product_product.py10
-rw-r--r--indoteknik_custom/models/solr/product_template.py5
2 files changed, 13 insertions, 2 deletions
diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py
index 720be7fa..15c910a5 100644
--- a/indoteknik_custom/models/solr/product_product.py
+++ b/indoteknik_custom/models/solr/product_product.py
@@ -1,4 +1,4 @@
-from odoo import models, fields
+from odoo import models, fields, api
from datetime import datetime
@@ -186,4 +186,10 @@ class ProductProduct(models.Model):
results.append(result)
- return results \ No newline at end of file
+ return results
+
+ @api.constrains('active')
+ def constrains_active(self):
+ for rec in self:
+ rec.product_tmpl_id._create_solr_queue_sync_product_template()
+ \ No newline at end of file
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py
index cc8d4bf2..f178dd5f 100644
--- a/indoteknik_custom/models/solr/product_template.py
+++ b/indoteknik_custom/models/solr/product_template.py
@@ -221,3 +221,8 @@ class ProductTemplate(models.Model):
results.append(result)
return results
+
+ @api.constrains('active')
+ def constrains_active(self):
+ for rec in self:
+ rec._create_solr_queue_sync_product_template() \ No newline at end of file