Purpose ======= This commit cleans the UTM module and uses a different file for each model views in order to clarify organization and ease reading. Each model owns its own view file. Task-2245823 Part-of: odoo/odoo#83070
34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import fields, models, api, SUPERUSER_ID
|
|
|
|
|
|
class UtmCampaign(models.Model):
|
|
_name = 'utm.campaign'
|
|
_description = 'UTM Campaign'
|
|
|
|
name = fields.Char(string='Campaign Name', required=True, translate=True)
|
|
|
|
user_id = fields.Many2one(
|
|
'res.users', string='Responsible',
|
|
required=True, default=lambda self: self.env.uid)
|
|
stage_id = fields.Many2one(
|
|
'utm.stage', string='Stage', ondelete='restrict', required=True,
|
|
default=lambda self: self.env['utm.stage'].search([], limit=1),
|
|
group_expand='_group_expand_stage_ids')
|
|
tag_ids = fields.Many2many(
|
|
'utm.tag', 'utm_tag_rel',
|
|
'tag_id', 'campaign_id', string='Tags')
|
|
|
|
is_auto_campaign = fields.Boolean(default=False, string="Automatically Generated Campaign", help="Allows us to filter relevant Campaigns")
|
|
color = fields.Integer(string='Color Index')
|
|
|
|
@api.model
|
|
def _group_expand_stage_ids(self, stages, domain, order):
|
|
"""Read group customization in order to display all the stages in the
|
|
Kanban view, even if they are empty.
|
|
"""
|
|
stage_ids = stages._search([], order=order, access_rights_uid=SUPERUSER_ID)
|
|
return stages.browse(stage_ids)
|