diff --git a/addons/im_livechat_mail_bot/models/mail_bot.py b/addons/im_livechat_mail_bot/models/mail_bot.py index 0c042d56fab..593e3d69f63 100644 --- a/addons/im_livechat_mail_bot/models/mail_bot.py +++ b/addons/im_livechat_mail_bot/models/mail_bot.py @@ -15,17 +15,8 @@ class MailBot(models.AbstractModel): return _("That's me! 🎉
Try to type \":\" to use canned responses.") elif odoobot_state == "onboarding_canned" and values.get("canned_response_ids"): self.env.user.odoobot_state = "idle" - discuss_href = 'href="/web#action=mail.mail_channel_action_client_chat&active_id=%s"' % record.id - discuss_src = 'src="/mail_bot/static/img/odoobot_discuss.png"' - chatter_src = 'src="/mail_bot/static/img/odoobot_chatter.png"' - return _("Good, you can customize your canned responses in the live chat application.

") + \ - _("There are 3 different ways in Odoo to interact with your colleagues:
\ --via this chat window
\ --via the Discuss application:


\ --or via the chatter:


\ -Aaaaand that's it! Enjoy discovering Odoo!") % (discuss_href, discuss_src, chatter_src) + return _("Good, you can customize canned responses in the live chat application.

It's the end of this overview, enjoy discovering Odoo!") #repeat question if needed elif odoobot_state == 'onboarding_canned': return _("Not sure wat you are doing. Please press : and wait for the propositions. Select one of them and press enter.") - return super(MailBot, self)._get_answer(record, body, values, command) diff --git a/addons/mail/static/src/img/smiley/odoobot.png b/addons/mail/static/src/img/smiley/odoobot.png deleted file mode 100644 index 49513b98ac1..00000000000 Binary files a/addons/mail/static/src/img/smiley/odoobot.png and /dev/null differ diff --git a/addons/mail/static/src/js/services/mail_manager.js b/addons/mail/static/src/js/services/mail_manager.js index ffdabefda15..49d7fc9c45e 100644 --- a/addons/mail/static/src/js/services/mail_manager.js +++ b/addons/mail/static/src/js/services/mail_manager.js @@ -242,7 +242,7 @@ var MailManager = AbstractService.extend({ previewsChannel = self._sortPreviews(previewsChannel); previewsInbox = self._sortPreviews(previewsInbox); previewsFailure = self._sortPreviews(previewsFailure); - return _.union(previewsFailure, previewsInbox, previewsChannel, previewsStatic); + return _.union(previewsStatic, previewsFailure, previewsInbox, previewsChannel); }); }, /** @@ -832,9 +832,9 @@ var MailManager = AbstractService.extend({ ) { elems.push({ title: _t("Odoobot has a request for you"), - imageSRC: "/mail/static/src/img/smiley/odoobot.png", + imageSRC: "/mail/static/src/img/odoobot.png", status: 'bot', - body: _t("Enable desktop notifications to stay up to date"), + body: _t("Enable desktop notifications to chat"), id: 'request_notification', }); } diff --git a/addons/mail_bot/__manifest__.py b/addons/mail_bot/__manifest__.py index 01885576d16..eef58113154 100644 --- a/addons/mail_bot/__manifest__.py +++ b/addons/mail_bot/__manifest__.py @@ -16,6 +16,9 @@ 'views/assets.xml', 'data/mailbot_data.xml', ], + 'demo': [ + 'data/mailbot_demo.xml', + ], 'qweb': [ 'views/discuss.xml', ], diff --git a/addons/mail_bot/data/mailbot_demo.xml b/addons/mail_bot/data/mailbot_demo.xml new file mode 100644 index 00000000000..c5d68ad7a60 --- /dev/null +++ b/addons/mail_bot/data/mailbot_demo.xml @@ -0,0 +1,9 @@ + + + + + + disabled + + + diff --git a/addons/mail_bot/models/mail_bot.py b/addons/mail_bot/models/mail_bot.py index 50d43185454..6e973056988 100644 --- a/addons/mail_bot/models/mail_bot.py +++ b/addons/mail_bot/models/mail_bot.py @@ -38,47 +38,41 @@ class MailBot(models.AbstractModel): # main flow if odoobot_state == 'onboarding_emoji' and self._body_contains_emoji(body): self.env.user.odoobot_state = "onboarding_attachement" - return _("Great! :) Did you notice that you can also send attachments, like a picture of your cute dog? Try it!") + return _("Great! 👍
Now, try to send an attachment, like a picture of your cute dog...") elif odoobot_state == 'onboarding_attachement' and values.get("attachment_ids"): self.env.user.odoobot_state = "onboarding_command" - return _("Not a cute dog, but you get it :) To access special features, start your sentence with '/' (e.g. /help).") + return _("Not a cute dog, but you get it 😊
To access special features, start your sentence with '/'. Try to get help.") elif odoobot_state == 'onboarding_command' and command == 'help': self.env.user.odoobot_state = "onboarding_ping" - return _("Wow you are a natural! Ping someone to grab its attention with @nameoftheuser. Try to ping me with @OdooBot.") + return _("Wow you are a natural!
Ping someone to grab its attention with @nameoftheuser. Try to ping me using @OdooBot in a sentence.") elif odoobot_state == 'onboarding_ping' and self._is_bot_pinged(values): self.env.user.odoobot_state = "idle" - discuss_href = 'href="/web#action=mail.mail_channel_action_client_chat&active_id=%s"' % record.id - discuss_src = 'src="/mail_bot/static/img/odoobot_discuss.png"' - chatter_src = 'src="/mail_bot/static/img/odoobot_chatter.png"' - return _("That's me! 🎉
") + \ - _("There are 3 different ways in Odoo to interact with your colleagues:
\ --via this chat window
\ --via the Discuss application:


\ --or via the chatter:


\ -Aaaaand that's it! Enjoy discovering Odoo!") % (discuss_href, discuss_src, chatter_src) + return _("Yet, I am here! 🎉
It's the end of this overview, enjoy discovering Odoo!") # easter eggs elif odoobot_state == "idle" and body in ['❤️', _('i love you'), _('love')]: return _("Aaaaaw that's really cute but, you know, bots don't work that way. You're too human for me! Let's keep it professional ❤️") - elif odoobot_state == "idle" and body in [_('help'), _('help me'), _('i need help')]: - return _("I'm trying to help you, but I'm just a bot... :( You can also check our documentation) for more information!") + elif odoobot_state == "idle" and (('help' in body) or _('help') in body): + return _("I'm just a bot... :( You can check our documentation) for more information!") elif odoobot_state == "idle" and _('fuck') in body or "fuck" in body: - return _("That's not a really nice thing to say, you know? I'm a bot but I have feelings, ok?! 💔") + return _("That's not nice! I'm a bot but I have feelings... 💔") else: #repeat question if odoobot_state == 'onboarding_emoji': - return _("Not exactly. To send an emoji, type \":)\" and press enter.") + return _("Not exactly. To continue the tour, send an emoji, type \":)\" and press enter.") elif odoobot_state == 'onboarding_attachement': - return _("I want you to send me an attachement, you should press the button next to the chat bar to select a file.") + return _("To send an attachment, click the 📎 icon on the right, and select a file.") elif odoobot_state == 'onboarding_command': return _("Not sure wat you are doing. Please press / and wait for the propositions. Select \"help\" and press enter") elif odoobot_state == 'onboarding_ping': - return _("Please, ping me. Type and \"@\" and begin to type \"odoobot\". Select the proposition and press enter.") + return _("Sorry, I am not listening. To get someone's attention, ping him. Write \"@odoobot\" and select me.") return random.choice([ - _("I'm not smart enough to answer your question, sorry."), - _("I'm afraid I don't understand. Sorry!") + _("I'm not smart enough to answer your question."), + _("Ok, what about you?"), + _("I'm afraid I don't understand. Sorry!"), + _("Sorry I'm sleepy. Or not! Maybe I'm just trying to hide my unawareness of human language..."), ]) elif self._is_bot_pinged(values): - return random.choice([_("Yaaaay that's me!"), _("Odeyhoooo")]) + return random.choice([_("Yep, Odoobot is in the place!"), _("Pong.")]) return False def _body_contains_emoji(self, body): diff --git a/addons/mail_bot/models/mail_channel.py b/addons/mail_bot/models/mail_channel.py index 60a8f7dd07d..f175baebb7c 100644 --- a/addons/mail_bot/models/mail_channel.py +++ b/addons/mail_bot/models/mail_channel.py @@ -35,7 +35,7 @@ class Channel(models.Model): 'email_send': False, 'name': 'OdooBot' }) - message = _("Hello, I'm here to help you discover chat features. Try answering me with an emoji 😊") + message = _("Hello,
I'm here to help you discover chat features. Try sending me an emoji :)") channel.message_post(body=message, author_id=odoobot_id, message_type="comment", subtype="mail.mt_comment") self.env.user.odoobot_state = 'onboarding_emoji' return channel diff --git a/addons/mail_bot/static/img/odoobot_chatter.png b/addons/mail_bot/static/img/odoobot_chatter.png deleted file mode 100644 index e9147652083..00000000000 Binary files a/addons/mail_bot/static/img/odoobot_chatter.png and /dev/null differ diff --git a/addons/mail_bot/static/img/odoobot_discuss.png b/addons/mail_bot/static/img/odoobot_discuss.png deleted file mode 100644 index 18949ce9f9e..00000000000 Binary files a/addons/mail_bot/static/img/odoobot_discuss.png and /dev/null differ diff --git a/addons/test_mail/tests/test_odoobot.py b/addons/test_mail/tests/test_odoobot.py index bf0f235069f..ff74fcc1083 100644 --- a/addons/test_mail/tests/test_odoobot.py +++ b/addons/test_mail/tests/test_odoobot.py @@ -33,7 +33,7 @@ class TestOdoobot(BaseFunctionalTest, MockEmails, TestRecipients): self.assertNextMessage( self.test_record_employe.with_context({'mail_post_autofollow': True}).message_post(**kwargs), sender=self.odoobot, - answer=["Yaaaay that's me!"] # no the perfect idea to base a test on a random but it should work for test phase, better mock random choice? + answer=["Yep, Odoobot is in the place!"] ) # Odoobot should not be a follower but user_employee and user_admin should follower = self.test_record.message_follower_ids.mapped('partner_id') @@ -50,14 +50,14 @@ class TestOdoobot(BaseFunctionalTest, MockEmails, TestRecipients): self.assertNextMessage( channel.message_post(**kwargs), sender=self.odoobot, - answer="Great! :) Did you notice that you can also send attachments, like a picture of your cute dog? Try it!" + answer=("attachment",) ) kwargs['body'] = '' kwargs['attachment_ids'] = [1] last_message = self.assertNextMessage( channel.message_post(**kwargs), sender=self.odoobot, - answer="Not a cute dog, but you get it :) To access special features, start your sentence with '/' (e.g. /help)." + answer=("help",) ) kwargs['attachment_ids'] = [] @@ -65,7 +65,7 @@ class TestOdoobot(BaseFunctionalTest, MockEmails, TestRecipients): self.assertNextMessage( last_message, # no message will be post with command help, use last odoobot message instead sender=self.odoobot, - answer="Wow you are a natural! Ping someone to grab its attention with @nameoftheuser. Try to ping me with @OdooBot." + answer=("@OdooBot",) ) # we dont test the end of the flow since it will depends of the installed apps (livechat) self.user_employee.odoobot_state = "idle" @@ -74,13 +74,13 @@ class TestOdoobot(BaseFunctionalTest, MockEmails, TestRecipients): self.assertNextMessage( channel.message_post(**kwargs), sender=self.odoobot, - answer="Aaaaaw that's really cute but, you know, bots don't work that way. You're too human for me! Let's keep it professional ❤️" + answer=("too human for me",) ) kwargs['body'] = "Go fuck yourself" self.assertNextMessage( channel.message_post(**kwargs), sender=self.odoobot, - answer="That's not a really nice thing to say, you know? I'm a bot but I have feelings, ok?! 💔" + answer=("I have feelings",) ) @mute_logger('odoo.addons.mail.models.mail_mail')