diff --git a/addons/utm/i18n/utm.pot b/addons/utm/i18n/utm.pot index f8d5629bb5a..c0392cbe3e8 100644 --- a/addons/utm/i18n/utm.pot +++ b/addons/utm/i18n/utm.pot @@ -554,6 +554,13 @@ msgid "" "progress, done, …)." msgstr "" +#. module: utm +#: model:ir.model.fields,help:utm.field_utm_tag__color +msgid "" +"Tag color. No color means no display in kanban to distinguish internal tags " +"from public categorization tags." +msgstr "" + #. module: utm #: model:ir.model.constraint,message:utm.constraint_utm_tag_name_uniq msgid "Tag name already exists !" diff --git a/addons/utm/models/utm.py b/addons/utm/models/utm.py index 3c197d1814e..0bf712c4be4 100644 --- a/addons/utm/models/utm.py +++ b/addons/utm/models/utm.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from random import randint + from odoo import fields, models, api, SUPERUSER_ID @@ -64,9 +66,14 @@ class UtmTag(models.Model): _description = 'UTM Tag' _order = 'name' + def _default_color(self): + return randint(1, 11) + name = fields.Char(required=True, translate=True) - color = fields.Integer(string='Color Index') + color = fields.Integer( + string='Color Index', default=lambda self: self._default_color(), + help='Tag color. No color means no display in kanban to distinguish internal tags from public categorization tags.') _sql_constraints = [ - ('name_uniq', 'unique (name)', "Tag name already exists !"), + ('name_uniq', 'unique (name)', "Tag name already exists !"), ]