From 90cb44e1e1b6bad9c12f3bd14d1c9e340461e19e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Thu, 20 Apr 2023 19:11:13 +0000 Subject: [PATCH] [REF] mail, *: rename mail.channel to discuss.channel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * = bus, calendar, crm_livechat, hr, hr_holidays, im_livechat, mail_bot, mass_mailing, privacy_lookup, test_discuss_full, test_mail, test_mail_full, website_crm_livechat, website_livechat, base In preparation of splitting discuss and mail modules. Part of task-3265211 closes odoo/odoo#118354 Related: odoo/upgrade#4553 Related: odoo/enterprise#39661 Signed-off-by: Sébastien Theys (seb) --- addons/bus/tests/test_ir_websocket.py | 2 +- addons/calendar/models/calendar_event.py | 4 +- addons/crm_livechat/models/__init__.py | 2 +- .../models/chatbot_script_step.py | 16 +- .../{mail_channel.py => discuss_channel.py} | 4 +- .../static/src/core/channel_commands.js | 2 +- .../static/tests/composer_tests.js | 2 +- .../crm_livechat/tests/test_chatbot_lead.py | 16 +- addons/crm_livechat/tests/test_crm_lead.py | 6 +- .../models/gamification_challenge.py | 2 +- addons/hr/__manifest__.py | 2 +- addons/hr/models/__init__.py | 2 +- .../{mail_channel.py => discuss_channel.py} | 2 +- addons/hr/models/hr_employee.py | 4 +- addons/hr/tests/test_channel.py | 2 +- ...el_views.xml => discuss_channel_views.xml} | 8 +- .../hr_holidays/static/src/thread_patch.xml | 2 +- .../static/tests/im_status_patch_tests.js | 12 +- .../static/tests/thread_icon_patch_tests.js | 6 +- .../static/tests/thread_patch_tests.js | 2 +- .../hr_holidays/tests/test_out_of_office.py | 2 +- addons/im_livechat/__manifest__.py | 6 +- addons/im_livechat/controllers/chatbot.py | 46 +-- addons/im_livechat/controllers/main.py | 20 +- ...de_data.xml => discuss_shortcode_data.xml} | 0 ...de_demo.xml => discuss_shortcode_demo.xml} | 0 .../data/im_livechat_channel_demo.xml | 246 ++++++------ addons/im_livechat/models/__init__.py | 4 +- addons/im_livechat/models/chatbot_message.py | 4 +- addons/im_livechat/models/chatbot_script.py | 14 +- .../im_livechat/models/chatbot_script_step.py | 50 +-- addons/im_livechat/models/digest.py | 4 +- .../{mail_channel.py => discuss_channel.py} | 24 +- ...el_member.py => discuss_channel_member.py} | 6 +- .../im_livechat/models/im_livechat_channel.py | 30 +- addons/im_livechat/models/mail_message.py | 8 +- addons/im_livechat/models/rating_rating.py | 6 +- addons/im_livechat/models/res_partner.py | 4 +- .../report/im_livechat_report_channel.py | 12 +- .../report/im_livechat_report_operator.py | 8 +- .../security/im_livechat_channel_security.xml | 4 +- .../src/composer/channel_commands_patch.js | 2 +- .../src/core/messaging_service_patch.js | 2 +- .../src/legacy/public_livechat_chatbot.js | 8 +- .../public_models/livechat_button_view.js | 2 +- ...ic_livechat_global_notification_handler.js | 4 +- .../src/legacy/widgets/livechat_button.js | 2 +- .../public_livechat_view.js | 2 +- .../static/tests/chat_window_patch_tests.js | 6 +- .../static/tests/composer_patch_tests.js | 18 +- .../static/tests/discuss_patch_tests.js | 20 +- .../helpers/mock_server/controllers/main.js | 10 +- .../{mail_channel.js => discuss_channel.js} | 8 +- ...el_member.js => discuss_channel_member.js} | 10 +- .../mock_server/models/im_livechat_channel.js | 18 +- .../helpers/mock_server/models/res_partner.js | 4 +- .../tests/messaging_menu_patch_tests.js | 2 +- .../tests/messaging_service_patch_tests.js | 4 +- .../mobile_messaging_menu_patch_tests.js | 2 +- .../static/tests/sidebar_patch_tests.js | 40 +- .../static/tests/thread_icon_patch_tests.js | 4 +- addons/im_livechat/tests/__init__.py | 2 +- addons/im_livechat/tests/chatbot_common.py | 8 +- .../tests/test_chatbot_internals.py | 16 +- addons/im_livechat/tests/test_digest.py | 10 +- ...channel.py => test_get_discuss_channel.py} | 54 +-- .../tests/test_im_livechat_report.py | 6 +- addons/im_livechat/tests/test_message.py | 6 +- ...el_views.xml => discuss_channel_views.xml} | 54 +-- .../views/im_livechat_channel_views.xml | 4 +- addons/mail/__manifest__.py | 14 +- addons/mail/controllers/bus.py | 10 +- addons/mail/controllers/discuss.py | 112 +++--- addons/mail/controllers/home.py | 8 +- ...nnel_data.xml => discuss_channel_data.xml} | 10 +- ...nnel_demo.xml => discuss_channel_demo.xml} | 30 +- addons/mail/models/__init__.py | 6 +- .../{mail_channel.py => discuss_channel.py} | 138 +++---- ...el_member.py => discuss_channel_member.py} | 61 ++- ...sion.py => discuss_channel_rtc_session.py} | 20 +- addons/mail/models/ir_attachment.py | 4 +- addons/mail/models/ir_websocket.py | 10 +- addons/mail/models/mail_guest.py | 2 +- addons/mail/models/mail_link_preview.py | 8 +- addons/mail/models/mail_message.py | 2 +- addons/mail/models/res_groups.py | 4 +- addons/mail/models/res_partner.py | 16 +- addons/mail/models/res_users.py | 12 +- addons/mail/populate/__init__.py | 4 +- .../{mail_channel.py => discuss_channel.py} | 2 +- ...el_member.py => discuss_channel_member.py} | 10 +- addons/mail/populate/mail_message.py | 6 +- addons/mail/security/ir.model.access.csv | 16 +- addons/mail/security/mail_security.xml | 24 +- .../static/src/attachments/attachment_list.js | 4 +- .../src/attachments/attachment_model.js | 18 +- addons/mail/static/src/composer/composer.js | 2 +- .../static/src/composer/suggestion_service.js | 10 +- .../mail/static/src/core/channel_commands.js | 2 +- .../static/src/core/channel_member_model.js | 2 +- .../static/src/core/channel_member_service.js | 2 +- addons/mail/static/src/core/message_model.js | 6 +- .../mail/static/src/core/message_service.js | 8 +- .../mail/static/src/core/messaging_service.js | 72 ++-- addons/mail/static/src/core/store_service.js | 2 +- addons/mail/static/src/core/thread_model.js | 4 +- addons/mail/static/src/core/thread_service.js | 78 ++-- addons/mail/static/src/core_ui/message.js | 2 +- addons/mail/static/src/core_ui/message.xml | 10 +- .../static/src/discuss/channel_invitation.js | 13 +- .../static/src/discuss/channel_invitation.xml | 2 +- .../static/src/discuss/channel_member_list.js | 2 +- .../src/discuss/channel_member_list.xml | 8 +- .../static/src/discuss/channel_selector.js | 8 +- .../static/src/discuss/channel_selector.xml | 6 +- addons/mail/static/src/discuss/discuss.xml | 6 +- .../mail/static/src/public/discuss_public.js | 2 +- addons/mail/static/src/public/welcome_page.js | 2 +- addons/mail/static/src/rtc/rtc_service.js | 12 +- .../mail/static/src/rtc/rtc_session_model.js | 2 +- addons/mail/static/src/scss/kanban_view.scss | 2 +- addons/mail/static/src/utils/format.js | 2 +- .../src/web/chat_window/chat_window.xml | 2 +- .../web/chat_window/chat_window_service.js | 13 +- addons/mail/static/src/web/chatter.xml | 2 +- addons/mail/static/src/web/command_palette.js | 4 +- addons/mail/static/src/web/discuss/sidebar.js | 6 +- addons/mail/static/src/web/message_patch.js | 2 +- .../static/src/web/messaging_service_patch.js | 2 +- .../tests/call/call_settings_menu_tests.js | 8 +- addons/mail/static/tests/call/call_tests.js | 24 +- .../chat_window/chat_window_manager_tests.js | 10 +- .../chat_window_new_message_tests.js | 4 +- .../tests/chat_window/chat_window_tests.js | 92 ++--- .../static/tests/composer/composer_tests.js | 104 ++--- .../static/tests/composer/typing_tests.js | 54 +-- .../mail/static/tests/core/open_chat_test.js | 2 +- .../static/tests/core/out_of_focus_tests.js | 4 +- .../static/tests/crosstab/crosstab_tests.js | 34 +- .../tests/discuss/channel_invitation_tests.js | 8 +- .../discuss/channel_member_list_tests.js | 28 +- .../static/tests/discuss/discuss_tests.js | 220 +++++------ .../static/tests/discuss/im_status_tests.js | 18 +- .../mail/static/tests/discuss/inbox_tests.js | 50 +-- .../tests/discuss/jump_to_present_tests.js | 14 +- .../tests/discuss/pinned_messages_tests.js | 28 +- .../static/tests/discuss/sidebar_tests.js | 128 +++--- addons/mail/static/tests/emoji/emoji_tests.js | 18 +- .../helpers/mock_server/controllers/bus.js | 10 +- .../mock_server/controllers/discuss.js | 77 ++-- .../{mail_channel.js => discuss_channel.js} | 365 +++++++++--------- ...el_member.js => discuss_channel_member.js} | 30 +- ...sion.js => discuss_channel_rtc_session.js} | 18 +- .../helpers/mock_server/models/mail_thread.js | 16 +- .../helpers/mock_server/models/res_partner.js | 16 +- .../helpers/mock_server/models/res_users.js | 2 +- .../tests/helpers/model_definitions_setup.js | 12 +- .../mail/static/tests/helpers/test_utils.js | 6 +- .../static/tests/helpers/webclient_setup.js | 2 +- .../static/tests/message/link_preview_test.js | 56 +-- .../tests/message/message_reply_tests.js | 20 +- .../message/message_seen_indicator_tests.js | 96 ++--- .../static/tests/message/message_tests.js | 222 +++++------ .../static/tests/messaging/messaging_tests.js | 8 +- .../messaging_menu/messaging_menu_tests.js | 90 ++--- .../messaging_menu/notification_tests.js | 34 +- .../mail/static/tests/mobile/mobile_tests.js | 2 +- .../tests/suggestion/suggestion_tests.js | 22 +- .../tests/thread/attachment_list_tests.js | 54 +-- .../static/tests/thread/file_upload_tests.js | 8 +- .../mail/static/tests/thread/thread_tests.js | 144 +++---- .../tours/discuss_channel_as_guest_tour.js | 87 +++++ .../static/tests/tours/discuss_public_tour.js | 6 +- .../tests/tours/mail_channel_as_guest_tour.js | 83 ---- .../static/tests/web/command_palette_tests.js | 4 +- addons/mail/tests/__init__.py | 6 +- addons/mail/tests/common.py | 6 +- ...ail_channel.py => test_discuss_channel.py} | 190 +++++---- ...st.py => test_discuss_channel_as_guest.py} | 18 +- ...mber.py => test_discuss_channel_member.py} | 90 ++--- addons/mail/tests/test_link_preview.py | 12 +- addons/mail/tests/test_rtc.py | 144 +++---- ...s.xml => discuss_channel_member_views.xml} | 18 +- ... => discuss_channel_rtc_session_views.xml} | 22 +- ...el_views.xml => discuss_channel_views.xml} | 40 +- addons/mail/views/mail_menus.xml | 16 +- addons/mail_bot/models/__init__.py | 2 +- .../{mail_channel.py => discuss_channel.py} | 2 +- addons/mail_bot/models/mail_bot.py | 4 +- addons/mail_bot/models/res_users.py | 4 +- .../tests/test_mailing_internals.py | 10 +- .../wizard/privacy_lookup_wizard.py | 2 +- .../tests/test_performance.py | 24 +- addons/test_mail/tests/test_mail_gateway.py | 8 +- addons/test_mail/tests/test_mail_message.py | 30 +- .../tests/test_mail_thread_internals.py | 4 +- .../tests/messaging_menu_patch_tests.js | 4 +- addons/test_mail_full/tests/test_odoobot.py | 2 +- .../website_crm_livechat/models/__init__.py | 2 +- .../models/chatbot_script_step.py | 10 +- .../website_crm_livechat/models/crm_lead.py | 4 +- .../{mail_channel.py => discuss_channel.py} | 6 +- .../website_livechat/controllers/chatbot.py | 10 +- addons/website_livechat/controllers/main.py | 2 +- addons/website_livechat/models/__init__.py | 2 +- .../models/chatbot_script_step.py | 6 +- .../{mail_channel.py => discuss_channel.py} | 8 +- .../models/im_livechat_channel.py | 14 +- addons/website_livechat/models/website.py | 2 +- .../models/website_visitor.py | 46 +-- .../src/core/messaging_service_patch.js | 2 +- .../static/src/core/thread_service_patch.js | 4 +- .../public_models/livechat_button_view.js | 2 +- .../public_models/public_livechat_global.js | 2 +- .../{mail_channel.js => discuss_channel.js} | 8 +- .../mock_server/models/website_visitor.js | 4 +- .../tests/helpers/model_definitions_setup.js | 2 +- .../static/tests/thread_patch_tests.js | 10 +- .../website_livechat/tests/test_chatbot_ui.py | 8 +- .../tests/test_livechat_basic_flow.py | 12 +- .../tests/test_livechat_request.py | 8 +- addons/website_livechat/tests/test_ui.py | 14 +- .../tests/test_website_visitor.py | 10 +- .../views/website_visitor_views.xml | 8 +- odoo/addons/base/models/ir_mail_server.py | 2 +- 225 files changed, 2509 insertions(+), 2468 deletions(-) rename addons/crm_livechat/models/{mail_channel.py => discuss_channel.py} (96%) rename addons/hr/models/{mail_channel.py => discuss_channel.py} (97%) rename addons/hr/views/{mail_channel_views.xml => discuss_channel_views.xml} (60%) rename addons/im_livechat/data/{mail_shortcode_data.xml => discuss_shortcode_data.xml} (100%) rename addons/im_livechat/data/{mail_shortcode_demo.xml => discuss_shortcode_demo.xml} (100%) rename addons/im_livechat/models/{mail_channel.py => discuss_channel.py} (93%) rename addons/im_livechat/models/{mail_channel_member.py => discuss_channel_member.py} (86%) rename addons/im_livechat/static/tests/helpers/mock_server/models/{mail_channel.js => discuss_channel.js} (76%) rename addons/im_livechat/static/tests/helpers/mock_server/models/{mail_channel_member.js => discuss_channel_member.js} (73%) rename addons/im_livechat/tests/{test_get_mail_channel.py => test_get_discuss_channel.py} (75%) rename addons/im_livechat/views/{mail_channel_views.xml => discuss_channel_views.xml} (76%) rename addons/mail/data/{mail_channel_data.xml => discuss_channel_data.xml} (76%) rename addons/mail/data/{mail_channel_demo.xml => discuss_channel_demo.xml} (91%) rename addons/mail/models/{mail_channel.py => discuss_channel.py} (91%) rename addons/mail/models/{mail_channel_member.py => discuss_channel_member.py} (79%) rename addons/mail/models/{mail_channel_rtc_session.py => discuss_channel_rtc_session.py} (83%) rename addons/mail/populate/{mail_channel.py => discuss_channel.py} (93%) rename addons/mail/populate/{mail_channel_member.py => discuss_channel_member.py} (68%) rename addons/mail/static/tests/helpers/mock_server/models/{mail_channel.js => discuss_channel.js} (67%) rename addons/mail/static/tests/helpers/mock_server/models/{mail_channel_member.js => discuss_channel_member.js} (55%) rename addons/mail/static/tests/helpers/mock_server/models/{mail_channel_rtc_session.js => discuss_channel_rtc_session.js} (55%) create mode 100644 addons/mail/static/tests/tours/discuss_channel_as_guest_tour.js delete mode 100644 addons/mail/static/tests/tours/mail_channel_as_guest_tour.js rename addons/mail/tests/{test_mail_channel.py => test_discuss_channel.py} (71%) rename addons/mail/tests/{test_mail_channel_as_guest.py => test_discuss_channel_as_guest.py} (82%) rename addons/mail/tests/{test_mail_channel_member.py => test_discuss_channel_member.py} (70%) rename addons/mail/views/{mail_channel_member_views.xml => discuss_channel_member_views.xml} (71%) rename addons/mail/views/{mail_channel_rtc_session_views.xml => discuss_channel_rtc_session_views.xml} (71%) rename addons/mail/views/{mail_channel_views.xml => discuss_channel_views.xml} (80%) rename addons/mail_bot/models/{mail_channel.py => discuss_channel.py} (91%) rename addons/website_crm_livechat/models/{mail_channel.py => discuss_channel.py} (81%) rename addons/website_livechat/models/{mail_channel.py => discuss_channel.py} (95%) rename addons/website_livechat/static/tests/helpers/mock_server/models/{mail_channel.js => discuss_channel.js} (79%) 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 + -