diff options
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/models/wati.py | 13 | ||||
| -rwxr-xr-x | indoteknik_custom/models/x_manufactures.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/wati.xml | 14 | ||||
| -rwxr-xr-x | indoteknik_custom/views/x_manufactures.xml | 6 |
5 files changed, 33 insertions, 3 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 051f11ec..a794a822 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -61,6 +61,7 @@ 'views/website_ads.xml', 'views/leads_monitoring.xml', 'views/ip_lookup.xml', + 'views/wati.xml', 'report/report.xml', 'report/report_banner_banner.xml', 'report/report_banner_banner2.xml', diff --git a/indoteknik_custom/models/wati.py b/indoteknik_custom/models/wati.py index e2e723ef..df467ea1 100644 --- a/indoteknik_custom/models/wati.py +++ b/indoteknik_custom/models/wati.py @@ -1,4 +1,5 @@ from odoo import fields, models, api +from datetime import datetime, timedelta import logging import json @@ -11,6 +12,18 @@ class WatiNotification(models.Model): json_raw = fields.Char(string='JSON Raw Text') is_lead = fields.Boolean(string='To Leads', help='apakah sudah ter-convert jadi leads') + def _cleanup(self): + current_time = datetime.now() + delta_time = current_time - timedelta(days=15) + + delta_time = delta_time.strftime('%Y-%m-%d %H:%M:%S') + self.env['wati.notification'].search([ + ('create_date', '<', delta_time), + ('is_lead', '=', True), + ]).unlink() + _logger.info('Success Cleanup WATI Notification') + + def _convert_to_leads(self): query = [ ('is_lead', '=', False) diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py index e6842797..dd6948a9 100755 --- a/indoteknik_custom/models/x_manufactures.py +++ b/indoteknik_custom/models/x_manufactures.py @@ -44,6 +44,8 @@ class XManufactures(models.Model): ], string="Cache Reset") sequence = fields.Integer(string='Sequence', help='Urutan tampil di homepage jika show as new product') show_as_new_product = fields.Boolean(string='Show as New Product', help='Centang jika ingin ditammpilkan di website sebagai segment Produk Baru') + parent_id = fields.Many2one('x_manufactures', string='Parent', help='Parent Brand tersebut') + category_ids = fields.Many2many('product.public.category', string='Category', help='Brand tsb memiliki Category apa saja') def cache_reset(self): manufactures = self.env['x_manufactures'].search([ diff --git a/indoteknik_custom/views/wati.xml b/indoteknik_custom/views/wati.xml new file mode 100644 index 00000000..fd0306be --- /dev/null +++ b/indoteknik_custom/views/wati.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<odoo> + <record id="cron_wati_cleanup" model="ir.cron"> + <field name="name">Wati: Cleansing Notification</field> + <field name="interval_number">15</field> + <field name="interval_type">days</field> + <field name="numbercall">-1</field> + <field name="doall" eval="False"/> + <field name="model_id" ref="model_wati_notification"/> + <field name="code">model._cleanup()</field> + <field name="state">code</field> + <field name="priority">28</field> + </record> +</odoo> diff --git a/indoteknik_custom/views/x_manufactures.xml b/indoteknik_custom/views/x_manufactures.xml index e51cb6a7..ce00c980 100755 --- a/indoteknik_custom/views/x_manufactures.xml +++ b/indoteknik_custom/views/x_manufactures.xml @@ -22,8 +22,7 @@ <field name="x_manufacture_level"/> <field name="x_manufacture_service_center"/> <field name="cache_reset_status"/> - <field name="show_as_new_product"/> - <field name="sequence"/> + <field name="parent_id"/> </tree> </field> </record> @@ -43,7 +42,8 @@ <field name="x_manufacture_level"/> <field name="x_produk_aksesoris_sparepart"/> <field name="cache_reset_status"/> - <field name="sequence"/> + <field name="parent_id"/> + <field name="category_ids" widget="many2many_tags"/> </group> <group> <field name="x_logo_manufacture" widget="image"/> |
