PURPOSE
Reorganize and lint mail.channel code. Purpose is to ease future modifications
linked to groups and channels in mail / Discuss.
SPECIFICATIONS
Move mail.channel.partner and mail.moderation models into their own file.
This makes some noise in diff but as channel is quite an heavy model let us
do this once for all.
Move mail.channel.partner views in their own file, as for python models.
Also containing
* separate and reorganize fields by main definition;
* separate and reorganize methods by categories, notably CRUD + orm, members
management, moderation, mailing, IM, commands;
* reorganize compute section: compute (by field order), constraints then
onchanges;
LINKS
Prepares Task ID-2070632 (Discuss channel task)
Prepares Task ID-2419762 (SM channel task)
COM PR odoo/odoo#64862
21 lines
688 B
Python
21 lines
688 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class Moderation(models.Model):
|
|
_name = 'mail.moderation'
|
|
_description = 'Channel black/white list'
|
|
|
|
email = fields.Char(string="Email", index=True, required=True)
|
|
status = fields.Selection([
|
|
('allow', 'Always Allow'),
|
|
('ban', 'Permanent Ban')],
|
|
string="Status", required=True)
|
|
channel_id = fields.Many2one('mail.channel', string="Channel", index=True, required=True)
|
|
|
|
_sql_constraints = [
|
|
('channel_email_uniq', 'unique (email,channel_id)', 'The email address must be unique per channel !')
|
|
]
|