diff --git a/chat_favourites_in_systray/README.rst b/chat_favourites_in_systray/README.rst new file mode 100755 index 000000000..e76866e2c --- /dev/null +++ b/chat_favourites_in_systray/README.rst @@ -0,0 +1,44 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Chat Favourites In Systray +========================= +This module helps you to enable desired chat's as favourite and view them from a shortcut added in systray + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers: Aiswarya JP@cybrosys + + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ + + diff --git a/chat_favourites_in_systray/__init__.py b/chat_favourites_in_systray/__init__.py new file mode 100644 index 000000000..a0cffd4b6 --- /dev/null +++ b/chat_favourites_in_systray/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from . import models +from . import controllers diff --git a/chat_favourites_in_systray/__manifest__.py b/chat_favourites_in_systray/__manifest__.py new file mode 100644 index 000000000..d43b32fe6 --- /dev/null +++ b/chat_favourites_in_systray/__manifest__.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# + +{ + 'name': "Chat Favourites in Systray", + 'version': '15.0.1.0.0', + 'summary': """Shortcut for Viewing Favourite Chats From Systray""", + 'description': """This module display favourite chats from a shortcut in systray""", + 'author': "Cybrosys Techno Solutions", + 'company': "Cybrosys Techno Solutions", + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'category': 'Tools', + 'depends': ['base', 'mail'], + 'data': [ + 'views/mail_message_views.xml'], + 'assets': { + 'web.assets_backend': [ + 'chat_favourites_in_systray/static/src/js/messaging_menu.js', + 'chat_favourites_in_systray/static/src/js/thread_preview.js', + 'chat_favourites_in_systray/static/src/js/notification_list.js', + 'chat_favourites_in_systray/static/src/js/thread.js', + ], + 'web.assets_qweb': [ + 'chat_favourites_in_systray/static/src/xml/systray.xml', + ], + }, + 'images': ['static/description/banner.png'], + 'installable': True, + 'auto_install': False, + 'license': 'AGPL-3', +} diff --git a/chat_favourites_in_systray/controllers/__init__.py b/chat_favourites_in_systray/controllers/__init__.py new file mode 100644 index 000000000..b2a2bc71e --- /dev/null +++ b/chat_favourites_in_systray/controllers/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from . import main diff --git a/chat_favourites_in_systray/controllers/main.py b/chat_favourites_in_systray/controllers/main.py new file mode 100644 index 000000000..6c7279a2c --- /dev/null +++ b/chat_favourites_in_systray/controllers/main.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions, (odoo@cybrosys.com) +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from odoo import http +from odoo.http import request + + +class ChatFavourite(http.Controller): + @http.route('/check_is_favourite', type='json', auth='user') + def check_is_favourite(self, **kw): + """Check whether the chat is favourite""" + result = [] + channel_id = request.env['mail.channel'].search([('is_favourite', '=', True)]) + for rec in channel_id: + result.append(rec.id) + return result + + @http.route('/mark_is_favourite', type='json', auth='user') + def mark_is_favourite(self, **kw): + """Make the selected chat as favourite""" + active_id = kw.get('active_id') + channel_id = request.env['mail.channel'].browse(active_id) + return channel_id.id + + @http.route('/enable_favourite', type='json', auth='user') + def enable_favourite(self, **kw): + """Enable the favourite button if selected""" + active_id = kw.get('active_id') + channel_id = request.env['mail.channel'].browse(active_id) + if channel_id: + channel_id.is_favourite = True + return channel_id.id + + @http.route('/disable_favourite', type='json', auth='user') + def disable_favourite(self, **kw): + """Disable the favourite button if deselected""" + active_id = kw.get('active_id') + channel_id = request.env['mail.channel'].browse(active_id) + if channel_id: + channel_id.is_favourite = False + return channel_id.id diff --git a/chat_favourites_in_systray/doc/RELEASE_NOTES.md b/chat_favourites_in_systray/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..6b336f491 --- /dev/null +++ b/chat_favourites_in_systray/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 14.09.2022 +#### Version 15.0.1.0.0 +##### ADD +- Initial commit for Chat Favourites In Systray Module diff --git a/chat_favourites_in_systray/models/__init__.py b/chat_favourites_in_systray/models/__init__.py new file mode 100644 index 000000000..aec1cf88d --- /dev/null +++ b/chat_favourites_in_systray/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from . import mail_message diff --git a/chat_favourites_in_systray/models/mail_message.py b/chat_favourites_in_systray/models/mail_message.py new file mode 100644 index 000000000..e29ead771 --- /dev/null +++ b/chat_favourites_in_systray/models/mail_message.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from odoo import fields, models + + +class MailChannel(models.Model): + _inherit = 'mail.channel' + + is_favourite = fields.Boolean("Favourite", default=False) + + def channel_info(self): + """ Extends the channel info by adding the is_favourite field + :rtype : list(dict) + """ + res = super(MailChannel, self).channel_info() + for rec in self: + for channel in res: + channel.update({ + 'is_favourite': rec.is_favourite + }) + return res diff --git a/chat_favourites_in_systray/static/description/assets/icons/check.png b/chat_favourites_in_systray/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/check.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/chevron.png b/chat_favourites_in_systray/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/chevron.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/cogs.png b/chat_favourites_in_systray/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/cogs.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/consultation.png b/chat_favourites_in_systray/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/consultation.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/ecom-black.png b/chat_favourites_in_systray/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/ecom-black.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/education-black.png b/chat_favourites_in_systray/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/education-black.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/hotel-black.png b/chat_favourites_in_systray/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/hotel-black.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/license.png b/chat_favourites_in_systray/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/license.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/lifebuoy.png b/chat_favourites_in_systray/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/lifebuoy.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/manufacturing-black.png b/chat_favourites_in_systray/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/manufacturing-black.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/pos-black.png b/chat_favourites_in_systray/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/pos-black.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/puzzle.png b/chat_favourites_in_systray/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/puzzle.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/restaurant-black.png b/chat_favourites_in_systray/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/restaurant-black.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/service-black.png b/chat_favourites_in_systray/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/service-black.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/trading-black.png b/chat_favourites_in_systray/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/trading-black.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/training.png b/chat_favourites_in_systray/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/training.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/update.png b/chat_favourites_in_systray/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/update.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/user.png b/chat_favourites_in_systray/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/user.png differ diff --git a/chat_favourites_in_systray/static/description/assets/icons/wrench.png b/chat_favourites_in_systray/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/icons/wrench.png differ diff --git a/chat_favourites_in_systray/static/description/assets/modules/approval_image.png b/chat_favourites_in_systray/static/description/assets/modules/approval_image.png new file mode 100644 index 000000000..84fe94e80 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/modules/approval_image.png differ diff --git a/chat_favourites_in_systray/static/description/assets/modules/dynamic_image.png b/chat_favourites_in_systray/static/description/assets/modules/dynamic_image.png new file mode 100644 index 000000000..f55c47e0f Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/modules/dynamic_image.png differ diff --git a/chat_favourites_in_systray/static/description/assets/modules/list_view_image.png b/chat_favourites_in_systray/static/description/assets/modules/list_view_image.png new file mode 100644 index 000000000..510d36ae9 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/modules/list_view_image.png differ diff --git a/chat_favourites_in_systray/static/description/assets/modules/multiple_ref_image.png b/chat_favourites_in_systray/static/description/assets/modules/multiple_ref_image.png new file mode 100644 index 000000000..3fe90e552 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/modules/multiple_ref_image.png differ diff --git a/chat_favourites_in_systray/static/description/assets/modules/print_image.png b/chat_favourites_in_systray/static/description/assets/modules/print_image.png new file mode 100644 index 000000000..b470725a1 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/modules/print_image.png differ diff --git a/chat_favourites_in_systray/static/description/assets/modules/product_return_image.png b/chat_favourites_in_systray/static/description/assets/modules/product_return_image.png new file mode 100644 index 000000000..3afc14722 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/modules/product_return_image.png differ diff --git a/chat_favourites_in_systray/static/description/assets/screenshots/hero.png b/chat_favourites_in_systray/static/description/assets/screenshots/hero.png new file mode 100644 index 000000000..da9ab9889 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/screenshots/hero.png differ diff --git a/chat_favourites_in_systray/static/description/assets/screenshots/screenshot1.png b/chat_favourites_in_systray/static/description/assets/screenshots/screenshot1.png new file mode 100644 index 000000000..f23b0d9f9 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/screenshots/screenshot1.png differ diff --git a/chat_favourites_in_systray/static/description/assets/screenshots/screenshot2.png b/chat_favourites_in_systray/static/description/assets/screenshots/screenshot2.png new file mode 100644 index 000000000..16fd90426 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/screenshots/screenshot2.png differ diff --git a/chat_favourites_in_systray/static/description/assets/screenshots/screenshot3.1.png b/chat_favourites_in_systray/static/description/assets/screenshots/screenshot3.1.png new file mode 100644 index 000000000..cc10325e5 Binary files /dev/null and b/chat_favourites_in_systray/static/description/assets/screenshots/screenshot3.1.png differ diff --git a/chat_favourites_in_systray/static/description/banner.png b/chat_favourites_in_systray/static/description/banner.png new file mode 100644 index 000000000..d42f4592e Binary files /dev/null and b/chat_favourites_in_systray/static/description/banner.png differ diff --git a/chat_favourites_in_systray/static/description/cybro_logo.png b/chat_favourites_in_systray/static/description/cybro_logo.png new file mode 100755 index 000000000..bb309114c Binary files /dev/null and b/chat_favourites_in_systray/static/description/cybro_logo.png differ diff --git a/chat_favourites_in_systray/static/description/cybrosys-login-user-details.png b/chat_favourites_in_systray/static/description/cybrosys-login-user-details.png new file mode 100755 index 000000000..38477eeed Binary files /dev/null and b/chat_favourites_in_systray/static/description/cybrosys-login-user-details.png differ diff --git a/chat_favourites_in_systray/static/description/icon.png b/chat_favourites_in_systray/static/description/icon.png new file mode 100644 index 000000000..cd534fdc9 Binary files /dev/null and b/chat_favourites_in_systray/static/description/icon.png differ diff --git a/chat_favourites_in_systray/static/description/index.html b/chat_favourites_in_systray/static/description/index.html new file mode 100644 index 000000000..fc66911d9 --- /dev/null +++ b/chat_favourites_in_systray/static/description/index.html @@ -0,0 +1,547 @@ +
+
+
+

+ Chat Favourites in Systray

+

+ Shortcut for viewing favourite chats from systray. +

+ +
+
+ + + + +
+
+

+ Overview +

+
+ +
+

+ Shortcut for viewing favourite chats from systray. +

+ +
+
+ +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Shortcut For Favourite Chats

+

+ Able to view favourite chats from shortcut added in systray.

+
+
+
+ +
+
+

+ Screenshots +

+
+ +
+

+ Mark Chat as Favourite

+

+ Able to mark each chat as favourite by clicking on the star icon. + Also able to remove the chat as favourite +

+ + +
+
+

+ Shortcut in Systray

+

+ Shortcut in systray for viewing the favourite chats.

+ +
+
+

+ Display favourite chats

+

+ By clicking on the star icon in the systray, all the favourite chats can be view from the dropdown.

+ +
+ +
+ + +
+
+

Suggested Products

+
+ + +
+
+ + + +
+
+
+

Our Services

+
+
+ +
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+
+

Our Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+ +
+
+ + + + + +
+
+
+

Need Help?

+
+
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
\ No newline at end of file diff --git a/chat_favourites_in_systray/static/description/login.png b/chat_favourites_in_systray/static/description/login.png new file mode 100755 index 000000000..38477eeed Binary files /dev/null and b/chat_favourites_in_systray/static/description/login.png differ diff --git a/chat_favourites_in_systray/static/src/js/messaging_menu.js b/chat_favourites_in_systray/static/src/js/messaging_menu.js new file mode 100644 index 000000000..a13f9bdc7 --- /dev/null +++ b/chat_favourites_in_systray/static/src/js/messaging_menu.js @@ -0,0 +1,25 @@ +/** @odoo-module **/ + +import { MessagingMenu } from '@mail/components/messaging_menu/messaging_menu'; + +import { patch } from 'web.utils'; + +const components = { MessagingMenu }; +const ajax = require('web.ajax'); +let favourite_button = false; + +patch(components.MessagingMenu.prototype, 'chat_favourites_in_systray/static/src/js/messaging_menu.js', { + + _onClickToggler(ev) { + this.favourite_button = false; + this.messagingMenu.update({ activeTabId: 'all' }); + return this._super(...arguments); + }, + + _onClickFavourite(ev) { + this.favourite_button = true; + favourite_button = true; + this.messagingMenu.update({ activeTabId: 'chat' }); + this.messagingMenu.toggleOpen(); + } +}); diff --git a/chat_favourites_in_systray/static/src/js/notification_list.js b/chat_favourites_in_systray/static/src/js/notification_list.js new file mode 100644 index 000000000..bcf197b2f --- /dev/null +++ b/chat_favourites_in_systray/static/src/js/notification_list.js @@ -0,0 +1,31 @@ +/** @odoo-module **/ + +import { NotificationList } from '@mail/components/notification_list/notification_list'; +import { patch } from 'web.utils'; + +const components = { NotificationList }; +const ajax = require('web.ajax'); +components.NotificationList._allowedFilters.push('livechat'); + +patch(components.NotificationList.prototype, 'chat_favourites_in_systray/static/src/js/notification_list.js', { + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * Override to include favourite chats. + * + * @override + */ + _getThreads(props) { + if (this.__owl__.parent.favourite_button == true) { + return this.messaging.models['mail.thread'].all(thread => + thread.model === 'mail.channel'&& + thread.isChatChannel && + thread.is_favourite === true + ); + } + return this._super(...arguments); + }, +}); diff --git a/chat_favourites_in_systray/static/src/js/thread.js b/chat_favourites_in_systray/static/src/js/thread.js new file mode 100644 index 000000000..58da312a9 --- /dev/null +++ b/chat_favourites_in_systray/static/src/js/thread.js @@ -0,0 +1,32 @@ +/** @odoo-module **/ +import { + registerClassPatchModel, + registerFieldPatchModel, +} from '@mail/model/model_core'; +import { attr } from '@mail/model/model_field'; +import { insert, unlink } from '@mail/model/model_field_command'; + +registerClassPatchModel('mail.thread', 'chat_favourites_in_systray/static/src/js/thread.js', { + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + + /** + * @override + */ + convertData(data) { + const data2 = this._super(data); + if ('is_favourite' in data) { + data2.is_favourite = data.is_favourite; + data2.model = 'mail.channel'; + } + return data2; + }, + +}); + +registerFieldPatchModel('mail.thread', 'chat_favourites_in_systray/static/src/js/thread.js', { + + is_favourite: attr(), +}); diff --git a/chat_favourites_in_systray/static/src/js/thread_preview.js b/chat_favourites_in_systray/static/src/js/thread_preview.js new file mode 100644 index 000000000..cf60d4dd3 --- /dev/null +++ b/chat_favourites_in_systray/static/src/js/thread_preview.js @@ -0,0 +1,62 @@ +/** @odoo-module **/ + +import { ThreadPreview } from '@mail/components/thread_preview/thread_preview'; + +import { patch } from 'web.utils'; + +const components = { ThreadPreview }; +const ajax = require('web.ajax'); + +patch(components.ThreadPreview.prototype, 'chat_favourites_in_systray/static/src/js/thread_preview.js', { + + async willStart() { + const domain = [['id', '=', this.thread.id]]; + const fields = ['is_favourite']; + const configs = await this.rpc({ + args: [domain, fields], + method: 'search_read', + model: 'mail.channel', + }); + if (this.__owl__.parent.__owl__.parent.favourite_button){ + this.thread.favour_btn = true; + } + else{ + this.thread.favour_btn = false; + } + this.thread.is_favour = configs[0].is_favourite + }, + + _onClickMarkFavourite(ev) { + var self = this; + this.thread.starred = false; + ajax.jsonRpc('mark_is_favourite', 'call', { + 'model':'mail.channel', + 'active_id': this.thread.id, + }).then(function(result){ + var star = document.getElementById('star_icon_' + result) + if($(star).hasClass('text-danger')){ + $(star).removeClass('text-danger'); + $(star).addClass('text-muted'); + ajax.jsonRpc('/disable_favourite', 'call', { + model: 'mail.channel', + activate: false, + active_id : self.thread.id + }).then(function (data) { + self.thread.is_favour = false; + self.messaging.models['mail.thread'].performRpcChannelInfo({ ids: [self.thread.id] }) + }); + } else { + $(star).removeClass('text-muted'); + $(star).addClass("text-danger"); + ajax.jsonRpc('/enable_favourite', 'call', { + model: 'mail.channel', + activate: true, + active_id : self.thread.id + }).then(function (data) { + self.thread.is_favour = true; + self.messaging.models['mail.thread'].performRpcChannelInfo({ ids: [self.thread.id] }) + }); + } + }) + } +}); \ No newline at end of file diff --git a/chat_favourites_in_systray/static/src/xml/systray.xml b/chat_favourites_in_systray/static/src/xml/systray.xml new file mode 100644 index 000000000..e66305a98 --- /dev/null +++ b/chat_favourites_in_systray/static/src/xml/systray.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + +
+ +
+ \ No newline at end of file diff --git a/chat_favourites_in_systray/views/mail_message_views.xml b/chat_favourites_in_systray/views/mail_message_views.xml new file mode 100644 index 000000000..7024ee14f --- /dev/null +++ b/chat_favourites_in_systray/views/mail_message_views.xml @@ -0,0 +1,15 @@ + + + + + mail.channel.view.form.inherit.chat.favourites + mail.channel + + + + + + + + +