[FIX] utm: show campaign tags by default by giving them a color
Colorless tags are not displayed in kanban view of utm campaigns. When creating tags on the fly currently they have no color and are therefore not displayed once saving the campaign. This is not really intuitive for users. We now set a default value to color field of tags. They are now displayed by defauklt. LINKS Task ID-2300385 COM PR odoo/odoo#59872 ENT PR odoo/enterprise#14031 X-original-commit: 4f83be33d4cc53d50081050b3a9dee2892c562a4
This commit is contained in:
@@ -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 !"
|
||||
|
||||
@@ -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 !"),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user