diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-02-28 14:07:47 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-02-28 14:07:47 +0700 |
| commit | 00b6739e4f4228c1cc66de0ef63312bc633ae21f (patch) | |
| tree | 85f8fc83d4030878893599abb2a949e5d478e3e7 /indoteknik_custom/models/solr/apache_solr_queue.py | |
| parent | 0738a192409687790c16c757f85fe440cb1f377d (diff) | |
| parent | 46a7cc5601ceab2a7a6cdf4d74e0fa26ce13ab8a (diff) | |
Merge branch 'production' into purchasing-job
Diffstat (limited to 'indoteknik_custom/models/solr/apache_solr_queue.py')
| -rw-r--r-- | indoteknik_custom/models/solr/apache_solr_queue.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/indoteknik_custom/models/solr/apache_solr_queue.py b/indoteknik_custom/models/solr/apache_solr_queue.py index 07274295..1b51538f 100644 --- a/indoteknik_custom/models/solr/apache_solr_queue.py +++ b/indoteknik_custom/models/solr/apache_solr_queue.py @@ -18,6 +18,7 @@ class ApacheSolrQueue(models.Model): ('not_found', 'Record not found') ], 'Execute Status') execute_date = fields.Datetime('Execute Date') + description = fields.Text('Description') def _compute_display_name(self): for rec in self: @@ -38,6 +39,16 @@ class ApacheSolrQueue(models.Model): if elapsed_time > max_exec_time: break rec.execute_queue() + + def open_target_record(self): + return { + 'name': '', + 'view_mode': 'form', + 'res_model': self.res_model, + 'target': 'current', + 'type': 'ir.actions.act_window', + 'res_id': self.res_id + } def execute_queue(self): for rec in self: @@ -48,7 +59,8 @@ class ApacheSolrQueue(models.Model): _logger.info(f'Execute Queue: {res_model}.{function_name}() -> {res_id}') domain = [('id', '=', res_id)] - if res_model in ['product.template']: + model_incl_archive = ['product.template', 'promotion.program.line'] + if res_model in model_incl_archive: domain.append(('active', 'in', [True, False])) model_instance = self.env[res_model].search(domain) @@ -57,7 +69,8 @@ class ApacheSolrQueue(models.Model): rec.execute_status = 'success' else: rec.execute_status = 'not_found' - except: + except Exception as e: + rec.description = e rec.execute_status = 'failed' rec.execute_date = datetime.utcnow() self.env.cr.commit() |
