diff --git a/addons/note/models/note.py b/addons/note/models/note.py index 33035da5d5a..e5e8b471a10 100644 --- a/addons/note/models/note.py +++ b/addons/note/models/note.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 api, fields, models, _ from odoo.tools import html2plaintext @@ -22,8 +24,11 @@ class Tag(models.Model): _name = "note.tag" _description = "Note Tag" + def _get_default_color(self): + return randint(1, 11) + name = fields.Char('Tag Name', required=True, translate=True) - color = fields.Integer('Color Index') + color = fields.Integer('Color Index', default=_get_default_color) _sql_constraints = [ ('name_uniq', 'unique (name)', "Tag name already exists !"),