mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 11:12:05 +02:00
19.0 vanilla
This commit is contained in:
parent
d1963a3c3a
commit
2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models, api, SUPERUSER_ID
|
||||
from odoo import fields, models, api
|
||||
|
||||
|
||||
class UtmCampaign(models.Model):
|
||||
|
|
@ -9,6 +9,7 @@ class UtmCampaign(models.Model):
|
|||
_description = 'UTM Campaign'
|
||||
_rec_name = 'title'
|
||||
|
||||
active = fields.Boolean('Active', default=True)
|
||||
name = fields.Char(string='Campaign Identifier', required=True, compute='_compute_name',
|
||||
store=True, readonly=False, precompute=True, translate=False)
|
||||
title = fields.Char(string='Campaign Name', required=True, translate=True)
|
||||
|
|
@ -19,7 +20,7 @@ class UtmCampaign(models.Model):
|
|||
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')
|
||||
copy=False, group_expand='_group_expand_stage_ids')
|
||||
tag_ids = fields.Many2many(
|
||||
'utm.tag', 'utm_tag_rel',
|
||||
'tag_id', 'campaign_id', string='Tags')
|
||||
|
|
@ -27,9 +28,10 @@ class UtmCampaign(models.Model):
|
|||
is_auto_campaign = fields.Boolean(default=False, string="Automatically Generated Campaign", help="Allows us to filter relevant Campaigns")
|
||||
color = fields.Integer(string='Color Index')
|
||||
|
||||
_sql_constraints = [
|
||||
('unique_name', 'UNIQUE(name)', 'The name must be unique'),
|
||||
]
|
||||
_unique_name = models.Constraint(
|
||||
'UNIQUE(name)',
|
||||
'The name must be unique',
|
||||
)
|
||||
|
||||
@api.depends('title')
|
||||
def _compute_name(self):
|
||||
|
|
@ -51,9 +53,9 @@ class UtmCampaign(models.Model):
|
|||
return super().create(vals_list)
|
||||
|
||||
@api.model
|
||||
def _group_expand_stage_ids(self, stages, domain, order):
|
||||
def _group_expand_stage_ids(self, stages, domain):
|
||||
"""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)
|
||||
stage_ids = stages.sudo()._search([], order=stages._order)
|
||||
return stages.browse(stage_ids)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue