diff --git a/addons/bus/tests/test_ir_websocket.py b/addons/bus/tests/test_ir_websocket.py index 1a32e02c03c..c6eec9d612f 100644 --- a/addons/bus/tests/test_ir_websocket.py +++ b/addons/bus/tests/test_ir_websocket.py @@ -9,5 +9,5 @@ class TestIrWebsocket(common.HttpCase): self.env['ir.websocket']._subscribe({ 'inactivity_period': 1000, 'last': 0, - 'channels': [('odoo', 'mail.channel', 5)], + 'channels': [('odoo', 'discuss.channel', 5)], }) diff --git a/addons/calendar/models/calendar_event.py b/addons/calendar/models/calendar_event.py index d29c890d2bf..6311101d084 100644 --- a/addons/calendar/models/calendar_event.py +++ b/addons/calendar/models/calendar_event.py @@ -106,7 +106,7 @@ class Meeting(models.Model): videocall_location = fields.Char('Meeting URL', compute='_compute_videocall_location', store=True, copy=True) access_token = fields.Char('Invitation Token', store=True, copy=False, index=True) videocall_source = fields.Selection([('discuss', 'Discuss'), ('custom', 'Custom')], compute='_compute_videocall_source') - videocall_channel_id = fields.Many2one('mail.channel', 'Discuss Channel') + videocall_channel_id = fields.Many2one('discuss.channel', 'Discuss Channel') # visibility privacy = fields.Selection( [('public', 'Public'), @@ -756,7 +756,7 @@ class Meeting(models.Model): self.videocall_channel_id.channel_change_description(self.recurrence_id.name if self.recurrency else self.display_time) def _create_videocall_channel_id(self, name, partner_ids): - videocall_channel_id = self.env['mail.channel'].create_group(partner_ids, default_display_mode='video_full_screen', name=name) + videocall_channel_id = self.env['discuss.channel'].create_group(partner_ids, default_display_mode='video_full_screen', name=name) # if recurrent event, set channel to all other records of the same recurrency if self.recurrency: recurrent_events_without_channel = self.env['calendar.event'].search([ diff --git a/addons/crm_livechat/models/__init__.py b/addons/crm_livechat/models/__init__.py index c1a45883018..dd3b3f1c3f0 100644 --- a/addons/crm_livechat/models/__init__.py +++ b/addons/crm_livechat/models/__init__.py @@ -3,4 +3,4 @@ from . import chatbot_script from . import chatbot_script_step -from . import mail_channel +from . import discuss_channel diff --git a/addons/crm_livechat/models/chatbot_script_step.py b/addons/crm_livechat/models/chatbot_script_step.py index 2010ac10ae8..7d9acf2b11e 100644 --- a/addons/crm_livechat/models/chatbot_script_step.py +++ b/addons/crm_livechat/models/chatbot_script_step.py @@ -14,9 +14,9 @@ class ChatbotScriptStep(models.Model): help="Used in combination with 'create_lead' step type in order to automatically " "assign the created lead/opportunity to the defined team") - def _chatbot_crm_prepare_lead_values(self, mail_channel, description): + def _chatbot_crm_prepare_lead_values(self, discuss_channel, description): return { - 'description': description + mail_channel._get_channel_history(), + 'description': description + discuss_channel._get_channel_history(), 'name': _("%s's New Lead", self.chatbot_script_id.title), 'source_id': self.chatbot_script_id.source_id.id, 'team_id': self.crm_team_id.id, @@ -24,17 +24,17 @@ class ChatbotScriptStep(models.Model): 'user_id': False, } - def _process_step(self, mail_channel): + def _process_step(self, discuss_channel): self.ensure_one() - posted_message = super()._process_step(mail_channel) + posted_message = super()._process_step(discuss_channel) if self.step_type == 'create_lead': - self._process_step_create_lead(mail_channel) + self._process_step_create_lead(discuss_channel) return posted_message - def _process_step_create_lead(self, mail_channel): + def _process_step_create_lead(self, discuss_channel): """ When reaching a 'create_lead' step, we extract the relevant information: visitor's email, phone and conversation history to create a crm.lead. @@ -46,7 +46,7 @@ class ChatbotScriptStep(models.Model): their interest / needs before creating the lead. """ customer_values = self._chatbot_prepare_customer_values( - mail_channel, create_partner=False, update_partner=True) + discuss_channel, create_partner=False, update_partner=True) if self.env.user._is_public(): create_values = { 'email_from': customer_values['email'], @@ -60,6 +60,6 @@ class ChatbotScriptStep(models.Model): } create_values.update(self._chatbot_crm_prepare_lead_values( - mail_channel, customer_values['description'])) + discuss_channel, customer_values['description'])) self.env['crm.lead'].create(create_values) diff --git a/addons/crm_livechat/models/mail_channel.py b/addons/crm_livechat/models/discuss_channel.py similarity index 96% rename from addons/crm_livechat/models/mail_channel.py rename to addons/crm_livechat/models/discuss_channel.py index 46c4604d65e..ee9b6341b39 100644 --- a/addons/crm_livechat/models/mail_channel.py +++ b/addons/crm_livechat/models/discuss_channel.py @@ -6,8 +6,8 @@ from odoo import models, _ from odoo.tools import html2plaintext -class MailChannel(models.Model): - _inherit = 'mail.channel' +class DiscussChannel(models.Model): + _inherit = 'discuss.channel' def execute_command_lead(self, **kwargs): partner = self.env.user.partner_id diff --git a/addons/crm_livechat/static/src/core/channel_commands.js b/addons/crm_livechat/static/src/core/channel_commands.js index 53aabbf34d6..971276f8e0d 100644 --- a/addons/crm_livechat/static/src/core/channel_commands.js +++ b/addons/crm_livechat/static/src/core/channel_commands.js @@ -3,7 +3,7 @@ import { _lt } from "@web/core/l10n/translation"; import { registry } from "@web/core/registry"; -registry.category("mail.channel_commands").add("lead", { +registry.category("discuss.channel_commands").add("lead", { help: _lt("Create a new lead (/lead lead title)"), methodName: "execute_command_lead", }); diff --git a/addons/crm_livechat/static/tests/composer_tests.js b/addons/crm_livechat/static/tests/composer_tests.js index c9d409415b4..2ca02bf30fc 100644 --- a/addons/crm_livechat/static/tests/composer_tests.js +++ b/addons/crm_livechat/static/tests/composer_tests.js @@ -7,7 +7,7 @@ QUnit.module("composer"); QUnit.test("Can execute lead command", async function (assert) { const pyEnv = await startServer(); - const channelId = pyEnv["mail.channel"].create({ name: "General" }); + const channelId = pyEnv["discuss.channel"].create({ name: "General" }); const { openDiscuss } = await start({ mockRPC(route, args) { if (args.method === "execute_command_lead") { diff --git a/addons/crm_livechat/tests/test_chatbot_lead.py b/addons/crm_livechat/tests/test_chatbot_lead.py index 35e7a1b3c2a..31dadf0f308 100644 --- a/addons/crm_livechat/tests/test_chatbot_lead.py +++ b/addons/crm_livechat/tests/test_chatbot_lead.py @@ -33,19 +33,19 @@ class CrmChatbotCase(chatbot_common.CrmChatbotCase): self.assertEqual(created_lead.type, 'lead') def _chatbot_create_lead(self, user): - channel_info = self.livechat_channel._open_livechat_mail_channel( + channel_info = self.livechat_channel._open_livechat_discuss_channel( anonymous_name='Test Visitor', chatbot_script=self.chatbot_script, user_id=user.id) - mail_channel = self.env['mail.channel'].sudo().browse(channel_info['id']) + discuss_channel = self.env['discuss.channel'].sudo().browse(channel_info['id']) self._post_answer_and_trigger_next_step( - mail_channel, + discuss_channel, self.step_dispatch_create_lead.name, chatbot_script_answer=self.step_dispatch_create_lead ) - self.assertEqual(mail_channel.chatbot_current_step_id, self.step_create_lead_email) - self._post_answer_and_trigger_next_step(mail_channel, 'test2@example.com') + self.assertEqual(discuss_channel.chatbot_current_step_id, self.step_create_lead_email) + self._post_answer_and_trigger_next_step(discuss_channel, 'test2@example.com') - self.assertEqual(mail_channel.chatbot_current_step_id, self.step_create_lead_phone) - self._post_answer_and_trigger_next_step(mail_channel, '123456') + self.assertEqual(discuss_channel.chatbot_current_step_id, self.step_create_lead_phone) + self._post_answer_and_trigger_next_step(discuss_channel, '123456') - self.assertEqual(mail_channel.chatbot_current_step_id, self.step_create_lead) + self.assertEqual(discuss_channel.chatbot_current_step_id, self.step_create_lead) diff --git a/addons/crm_livechat/tests/test_crm_lead.py b/addons/crm_livechat/tests/test_crm_lead.py index 06f736c22a3..0286658edc5 100644 --- a/addons/crm_livechat/tests/test_crm_lead.py +++ b/addons/crm_livechat/tests/test_crm_lead.py @@ -31,7 +31,7 @@ class TestLivechatLead(TestCrmCommon): def test_crm_lead_creation_guest(self): """ Test customer set on lead: not if public, guest if not public """ # public: should not be set as customer - channel = self.env['mail.channel'].create({ + channel = self.env['discuss.channel'].create({ 'name': 'Chat with Visitor', 'channel_partner_ids': [(4, self.user_anonymous.partner_id.id)] }) @@ -48,7 +48,7 @@ class TestLivechatLead(TestCrmCommon): # 'base.public_user' is archived by default self.assertFalse(self.env.ref('base.public_user').active) - channel = self.env['mail.channel'].create({ + channel = self.env['discuss.channel'].create({ 'name': 'Chat with Visitor', 'channel_partner_ids': [(4, self.env.ref('base.public_partner').id)] }) @@ -69,7 +69,7 @@ class TestLivechatLead(TestCrmCommon): self.assertEqual(lead.partner_id, self.env['res.partner']) # portal: should be set as customer - channel = self.env['mail.channel'].create({ + channel = self.env['discuss.channel'].create({ 'name': 'Chat with Visitor', 'channel_partner_ids': [(4, self.user_portal.partner_id.id)] }) diff --git a/addons/gamification/models/gamification_challenge.py b/addons/gamification/models/gamification_challenge.py index 5156253a789..cdf8a7a0578 100644 --- a/addons/gamification/models/gamification_challenge.py +++ b/addons/gamification/models/gamification_challenge.py @@ -128,7 +128,7 @@ class Challenge(models.Model): ('yearly', "Yearly") ], default='never', string="Report Frequency", required=True) - report_message_group_id = fields.Many2one('mail.channel', string="Send a copy to", help="Group that will receive a copy of the report in addition to the user") + report_message_group_id = fields.Many2one('discuss.channel', string="Send a copy to", help="Group that will receive a copy of the report in addition to the user") report_template_id = fields.Many2one('mail.template', default=lambda self: self._get_report_template(), string="Report Template", required=True) remind_update_delay = fields.Integer("Non-updated manual goals will be reminded after", help="Never reminded if no value or zero is specified.") last_report_date = fields.Date("Last Report Date", default=fields.Date.today) diff --git a/addons/hr/__manifest__.py b/addons/hr/__manifest__.py index 1919766969c..cc7a2915d63 100644 --- a/addons/hr/__manifest__.py +++ b/addons/hr/__manifest__.py @@ -34,7 +34,7 @@ 'views/hr_work_location_views.xml', 'views/hr_views.xml', 'views/res_config_settings_views.xml', - 'views/mail_channel_views.xml', + 'views/discuss_channel_views.xml', 'views/res_users.xml', 'views/res_partner_views.xml', 'views/hr_templates.xml', diff --git a/addons/hr/models/__init__.py b/addons/hr/models/__init__.py index 7e1a795a8ff..ab10987d906 100644 --- a/addons/hr/models/__init__.py +++ b/addons/hr/models/__init__.py @@ -14,7 +14,7 @@ from . import hr_plan_activity_type from . import hr_plan_employee_activity from . import hr_work_location from . import mail_alias -from . import mail_channel +from . import discuss_channel from . import models from . import res_config_settings from . import res_partner diff --git a/addons/hr/models/mail_channel.py b/addons/hr/models/discuss_channel.py similarity index 97% rename from addons/hr/models/mail_channel.py rename to addons/hr/models/discuss_channel.py index 05a96028d35..fbaa4ec4bb1 100644 --- a/addons/hr/models/mail_channel.py +++ b/addons/hr/models/discuss_channel.py @@ -6,7 +6,7 @@ from odoo.exceptions import ValidationError class Channel(models.Model): - _inherit = 'mail.channel' + _inherit = 'discuss.channel' subscription_department_ids = fields.Many2many( 'hr.department', string='HR Departments', diff --git a/addons/hr/models/hr_employee.py b/addons/hr/models/hr_employee.py index ad9b08e76de..4d2aa670d9e 100644 --- a/addons/hr/models/hr_employee.py +++ b/addons/hr/models/hr_employee.py @@ -354,7 +354,7 @@ class HrEmployeePrivate(models.Model): return employees employee_departments = employees.department_id if employee_departments: - self.env['mail.channel'].sudo().search([ + self.env['discuss.channel'].sudo().search([ ('subscription_department_ids', 'in', employee_departments.ids) ])._subscribe_users_automatically() onboarding_notes_bodies = {} @@ -392,7 +392,7 @@ class HrEmployeePrivate(models.Model): if vals.get('department_id') or vals.get('user_id'): department_id = vals['department_id'] if vals.get('department_id') else self[:1].department_id.id # When added to a department or changing user, subscribe to the channels auto-subscribed by department - self.env['mail.channel'].sudo().search([ + self.env['discuss.channel'].sudo().search([ ('subscription_department_ids', 'in', department_id) ])._subscribe_users_automatically() return res diff --git a/addons/hr/tests/test_channel.py b/addons/hr/tests/test_channel.py index 8caba47505f..dc79dee2117 100644 --- a/addons/hr/tests/test_channel.py +++ b/addons/hr/tests/test_channel.py @@ -10,7 +10,7 @@ class TestChannel(TestHrCommon): def setUpClass(cls): super(TestChannel, cls).setUpClass() - cls.channel = cls.env['mail.channel'].create({'name': 'Test'}) + cls.channel = cls.env['discuss.channel'].create({'name': 'Test'}) emp0 = cls.env['hr.employee'].create({ 'user_id': cls.res_users_hr_officer.id, diff --git a/addons/hr/views/mail_channel_views.xml b/addons/hr/views/discuss_channel_views.xml similarity index 60% rename from addons/hr/views/mail_channel_views.xml rename to addons/hr/views/discuss_channel_views.xml index b8c6e5df7ea..7ca308178d1 100644 --- a/addons/hr/views/mail_channel_views.xml +++ b/addons/hr/views/discuss_channel_views.xml @@ -1,9 +1,9 @@ - - mail.channel.view.form.inherit.hr - mail.channel - + + discuss.channel.view.form.inherit.hr + discuss.channel + -