From ac15504381b5b5ac8ba6029a97ebd01ed93c7f5d Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Thu, 2 Jun 2016 17:18:17 +0200 Subject: [PATCH] [9.0] [PORT] web_send_message_popup --- web_send_message_popup/README.rst | 59 +++++++++++++++++++ web_send_message_popup/__openerp__.py | 46 +++------------ .../static/src/js/chatter.js | 29 +++++++++ .../static/src/xml/mail.xml | 11 ---- .../views/web_send_message_popup.xml | 8 +++ 5 files changed, 103 insertions(+), 50 deletions(-) create mode 100644 web_send_message_popup/README.rst create mode 100644 web_send_message_popup/static/src/js/chatter.js delete mode 100644 web_send_message_popup/static/src/xml/mail.xml create mode 100644 web_send_message_popup/views/web_send_message_popup.xml diff --git a/web_send_message_popup/README.rst b/web_send_message_popup/README.rst new file mode 100644 index 00000000..4dd04b23 --- /dev/null +++ b/web_send_message_popup/README.rst @@ -0,0 +1,59 @@ +.. 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 + +========================= +Web Send Message as Popup +========================= + +In the email/notes threads below the form views, the link 'Send a +message' unfold a text field. From there, a button allows to open the +text field in a full featured email popup with the subject, templates, +attachments and followers. + +This module changes the link 'Send a message' so it opens directly the +full featured popup instead of the text field, avoiding an extra click +if the popup is always wanted. + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/162/9.0 + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Guewen Baconnier +* Yannick Vaucher + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/web_send_message_popup/__openerp__.py b/web_send_message_popup/__openerp__.py index 605174de..0a820d6b 100644 --- a/web_send_message_popup/__openerp__.py +++ b/web_send_message_popup/__openerp__.py @@ -1,49 +1,17 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Author: Guewen Baconnier -# Copyright 2014 Camptocamp SA -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# 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 for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - +# © 2014-2016 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). {'name': 'Web Send Message as Popup', - 'version': '1.0', - 'author': "Camptocamp,Odoo Community Association (OCA)", + 'version': '9.0.1.0.0', + 'author': "Camptocamp, Odoo Community Association (OCA)", 'maintainer': 'Camptocamp', 'license': 'AGPL-3', 'category': 'Hidden', 'depends': ['web', ], - 'description': """ -Web Send Message as Popup -========================= - -In the email/notes threads below the form views, the link 'Send a -message' unfold a text field. From there, a button allows to open the -text field in a full featured email popup with the subject, templates, -attachments and followers. - -This module changes the link 'Send a message' so it opens directly the -full featured popup instead of the text field, avoiding an extra click -if the popup is always wanted. - - """, 'website': 'http://www.camptocamp.com', - 'qweb': ['static/src/xml/mail.xml', + 'data': ['views/web_send_message_popup.xml' ], - 'installable': False, + 'installable': True, 'auto_install': False, -} + } diff --git a/web_send_message_popup/static/src/js/chatter.js b/web_send_message_popup/static/src/js/chatter.js new file mode 100644 index 00000000..d15dfd97 --- /dev/null +++ b/web_send_message_popup/static/src/js/chatter.js @@ -0,0 +1,29 @@ +/* © 2016 Camptocamp SA + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ +odoo.define('web_send_message_popup.Chatter', function (require) { +"use strict"; + +var core = require('web.core'); +var composer = require('mail.composer'); +var Chatter = core.form_widget_registry.get('mail_thread'); + +Chatter.include({ + on_open_composer_new_message: function () { + var self = this; + this.open_composer(); + // wait for composer input to be initialized + // taken from http://stackoverflow.com/questions/7307983/while-variable-is-not-defined-wait + function checkVariable() { + if (typeof self.composer !== 'undefined' && typeof self.composer.$input !== 'undefined') { + self.composer.on_open_full_composer(); + } + else { + setTimeout(function() { + checkVariable(); + }, 50); + } + } + checkVariable(); + } +}); +}); diff --git a/web_send_message_popup/static/src/xml/mail.xml b/web_send_message_popup/static/src/xml/mail.xml deleted file mode 100644 index 21029a47..00000000 --- a/web_send_message_popup/static/src/xml/mail.xml +++ /dev/null @@ -1,11 +0,0 @@ - - diff --git a/web_send_message_popup/views/web_send_message_popup.xml b/web_send_message_popup/views/web_send_message_popup.xml new file mode 100644 index 00000000..4acc483e --- /dev/null +++ b/web_send_message_popup/views/web_send_message_popup.xml @@ -0,0 +1,8 @@ + + + +