summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2024-03-01 13:44:14 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2024-03-01 13:44:14 +0700
commit388ea472f3913accd9e962f7f5c592860be98488 (patch)
tree6b8a86ee4b6b08fd038942983715d1f8c2e0f63c
parent57212906857d615c5c48e974bb56e3ce878e5ac4 (diff)
Add relation utm source to activity
-rw-r--r--indoteknik_custom/models/web_logging/user_activity_log.py5
-rw-r--r--indoteknik_custom/models/web_logging/web_utm_source.py1
-rw-r--r--indoteknik_custom/views/web_logging/web_utm_source.xml6
3 files changed, 7 insertions, 5 deletions
diff --git a/indoteknik_custom/models/web_logging/user_activity_log.py b/indoteknik_custom/models/web_logging/user_activity_log.py
index f48e9352..e60a9b74 100644
--- a/indoteknik_custom/models/web_logging/user_activity_log.py
+++ b/indoteknik_custom/models/web_logging/user_activity_log.py
@@ -30,11 +30,6 @@ class UserActivityLog(models.Model):
ip_location_country_code = fields.Text('IP Location Country Code')
ip_location_map = fields.Html('Embedded Map', compute='_compute_ip_location_map', sanitize=False)
-
- # @api.constrains('url')
- # def _constrains_url(self):
- # for rec in self:
- # rec.fill_utm_source()
@api.model
def create(self, vals):
result = super(UserActivityLog, self).create(vals)
diff --git a/indoteknik_custom/models/web_logging/web_utm_source.py b/indoteknik_custom/models/web_logging/web_utm_source.py
index 08b1e514..31e36dd6 100644
--- a/indoteknik_custom/models/web_logging/web_utm_source.py
+++ b/indoteknik_custom/models/web_logging/web_utm_source.py
@@ -6,6 +6,7 @@ class UserActivityLog(models.Model):
name = fields.Char(string='Name')
key = fields.Char(string='Key')
+ activity_ids = fields.One2many('user.activity.log', 'utm_source_id', string='Activity')
def find_or_create_key(self, key):
utm_source = self.search([('key', '=', key)], limit=1)
diff --git a/indoteknik_custom/views/web_logging/web_utm_source.xml b/indoteknik_custom/views/web_logging/web_utm_source.xml
index 641effb5..36d8d434 100644
--- a/indoteknik_custom/views/web_logging/web_utm_source.xml
+++ b/indoteknik_custom/views/web_logging/web_utm_source.xml
@@ -7,6 +7,7 @@
<tree>
<field name="name"/>
<field name="key"/>
+ <field name="activity_ids"/>
</tree>
</field>
</record>
@@ -23,6 +24,11 @@
<field name="key"/>
</group>
</group>
+ <notebook>
+ <page string="Activity">
+ <field name="activity_ids" />
+ </page>
+ </notebook>
</sheet>
</form>
</field>