From bfaee558997160c891a394a9862ad338a494337f Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 29 Sep 2023 16:54:54 +0700 Subject: delete weekly solr & Helper by di Quotation / SO --- indoteknik_custom/models/solr/apache_solr_queue.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/solr/apache_solr_queue.py') diff --git a/indoteknik_custom/models/solr/apache_solr_queue.py b/indoteknik_custom/models/solr/apache_solr_queue.py index 6a5b480f..8dd7c273 100644 --- a/indoteknik_custom/models/solr/apache_solr_queue.py +++ b/indoteknik_custom/models/solr/apache_solr_queue.py @@ -1,5 +1,5 @@ from odoo import models, fields -from datetime import datetime +from datetime import datetime, timedelta import logging, time @@ -72,3 +72,12 @@ class ApacheSolrQueue(models.Model): if count == 0: self.create(payload) + def delete_weekly_solr(self, limit=500): + solr = self.search([ + ('execute_status', '=', 'success'), + ('execute_date', '>=', (datetime.utcnow() - timedelta(days=7))), + ], limit=limit) + for rec in solr: + rec.unlink() + + -- cgit v1.2.3 From 9fe4b646f1b1cda3d704a66dfbca3e935e38d96b Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 2 Oct 2023 16:45:07 +0700 Subject: Group by brand, sync to solr when validate stock picking, add new name function solr queue --- indoteknik_custom/models/solr/apache_solr_queue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/solr/apache_solr_queue.py') diff --git a/indoteknik_custom/models/solr/apache_solr_queue.py b/indoteknik_custom/models/solr/apache_solr_queue.py index 8dd7c273..f66d356d 100644 --- a/indoteknik_custom/models/solr/apache_solr_queue.py +++ b/indoteknik_custom/models/solr/apache_solr_queue.py @@ -8,7 +8,7 @@ _logger = logging.getLogger(__name__) class ApacheSolrQueue(models.Model): _name = 'apache.solr.queue' - display_name = fields.Char('Display Name', compute="_compute_display_name") + display_name = fields.Char('Display Name', compute="_compute_display_name", store=True) res_model = fields.Char('Resource Model') res_id = fields.Integer('Resource ID') function_name = fields.Char('Function Name') -- cgit v1.2.3 From d238f43442cc27db0d0c05bba99b42b41eaadf54 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 3 Oct 2023 13:48:03 +0700 Subject: fix compute display name --- indoteknik_custom/models/solr/apache_solr_queue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/solr/apache_solr_queue.py') diff --git a/indoteknik_custom/models/solr/apache_solr_queue.py b/indoteknik_custom/models/solr/apache_solr_queue.py index f66d356d..8dd7c273 100644 --- a/indoteknik_custom/models/solr/apache_solr_queue.py +++ b/indoteknik_custom/models/solr/apache_solr_queue.py @@ -8,7 +8,7 @@ _logger = logging.getLogger(__name__) class ApacheSolrQueue(models.Model): _name = 'apache.solr.queue' - display_name = fields.Char('Display Name', compute="_compute_display_name", store=True) + display_name = fields.Char('Display Name', compute="_compute_display_name") res_model = fields.Char('Resource Model') res_id = fields.Integer('Resource ID') function_name = fields.Char('Function Name') -- cgit v1.2.3