diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-07-12 16:41:03 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-07-12 16:41:03 +0700 |
| commit | 6ff0d84f96fc104033732c00a553eee16e432169 (patch) | |
| tree | 55336da6d07f499fa6442196c232ecdb523233a4 /indoteknik_custom/models/solr/promotion_program.py | |
| parent | 17fd1072ccd6f2f74f73dd2e52ce7f0120adb3ce (diff) | |
<iman> add sync to solr promotion program
Diffstat (limited to 'indoteknik_custom/models/solr/promotion_program.py')
| -rw-r--r-- | indoteknik_custom/models/solr/promotion_program.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/indoteknik_custom/models/solr/promotion_program.py b/indoteknik_custom/models/solr/promotion_program.py index 0d417b3e..583d7df3 100644 --- a/indoteknik_custom/models/solr/promotion_program.py +++ b/indoteknik_custom/models/solr/promotion_program.py @@ -66,3 +66,17 @@ class PromotionProgram(models.Model): for line in rec.program_line: line._create_solr_queue('_sync_to_solr') + def solr_flag_to_queue(self, limit=500): + domain = [ + ('solr_flag', '=', 2), + ('active', 'in', [True, False]) + ] + records = self.search(domain, limit=limit) + for record in records: + record._create_solr_queue('_sync_to_solr') + record.solr_flag = 1 + + def action_sync_to_solr(self): + rec_ids = self.env.context.get('active_ids', []) + recs = self.search([('id', 'in', rec_ids)]) + recs._create_solr_queue('_sync_to_solr')
\ No newline at end of file |
