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


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

    name = fields.Char(string='Name')
    key = fields.Char(string='Key')
    
    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