summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/web_logging/web_utm_source.py
blob: 31e36dd68dd9f4a46dcd4f5a1106722c813d32ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from odoo import fields, models


class UserActivityLog(models.Model):
    _name = 'web.utm.source'

    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)
        if not utm_source and key:
            utm_source = self.create({
                'name': key,
                'key': key
            })
        return utm_source