summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/x_manufactures.py
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-01-04 14:52:28 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-01-04 14:52:28 +0700
commit7cc4bec031757d23c7f7f9e754fc2997d2dfd921 (patch)
tree2ace5dc432e04a4d8f91be276b3c8b83adda3935 /indoteknik_custom/models/x_manufactures.py
parent3a5407d507ff985e10b4675727643bf5af107d11 (diff)
parentb0f4f1875216bbb0347c082f38b91b59e5bbf50c (diff)
Merge branch 'release' into staging
Diffstat (limited to 'indoteknik_custom/models/x_manufactures.py')
-rwxr-xr-xindoteknik_custom/models/x_manufactures.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py
index 24b64c14..1d215cf8 100755
--- a/indoteknik_custom/models/x_manufactures.py
+++ b/indoteknik_custom/models/x_manufactures.py
@@ -1,5 +1,7 @@
from odoo import models, fields, api
+import logging
+_logger = logging.getLogger(__name__)
class XManufactures(models.Model):
_name = 'x_manufactures'
@@ -36,6 +38,24 @@ class XManufactures(models.Model):
], string="Jenis Produk")
x_short_desc = fields.Text(string="Short Description")
product_tmpl_ids = fields.One2many('product.template', 'x_manufacture', string='Product Templates')
+ cache_reset_status = fields.Selection([
+ ('reset', 'Reset'),
+ ('done', 'Done')
+ ], string="Cache Reset")
+
+ def cache_reset(self):
+ manufactures = self.env['x_manufactures'].search([
+ ('cache_reset_status', '=', 'reset'),
+ ])
+ for manufacture in manufactures:
+ products = self.env['product.template'].search([
+ ('x_manufacture', '=', manufacture.id),
+ ('solr_flag', '=', 1),
+ ])
+ for product in products:
+ product.solr_flag = 2
+ _logger.info("Reset Solr Flag to 2 %s" % product.id)
+ manufacture.cache_reset_status = 'done'
@api.onchange('x_name','image_promotion_1','image_promotion_2')
def update_solr_flag(self):