From 0df6766caef6a5b19270c5e7a6e4c6d011ffff86 Mon Sep 17 00:00:00 2001 From: ommo73 Date: Thu, 21 Mar 2019 16:10:35 +0500 Subject: [PATCH] :zap: mail_private New: internal users are flagged automatically. Added button "Uncheck all" --- mail_private/__openerp__.py | 33 +++++++++++++++----- mail_private/doc/changelog.rst | 7 +++-- mail_private/models.py | 3 ++ mail_private/static/src/css/mail_private.css | 8 +++++ mail_private/static/src/js/mail_private.js | 22 +++++++++++-- mail_private/static/src/xml/mail_private.xml | 6 ++++ mail_private/template.xml | 4 +++ mail_private/view.xml | 5 ++- 8 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 mail_private/static/src/css/mail_private.css diff --git a/mail_private/__openerp__.py b/mail_private/__openerp__.py index 90ee881a..9c858962 100644 --- a/mail_private/__openerp__.py +++ b/mail_private/__openerp__.py @@ -1,35 +1,54 @@ # -*- coding: utf-8 -*- +# Copyright 2016 x620 +# Copyright 2016 Ivan Yelizariev +# Copyright 2016 Ilmir Karamov +# Copyright 2019 Artem Rafailov +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). { "name": """Internal Messaging""", "summary": """Send private messages to specified recipients, regardless of who are in followers list.""", "category": "Discuss", - "images": ['images/mail_private_image.png'], - "version": "1.0.0", + # "live_test_url": "http://apps.it-projects.info/shop/product/DEMO-URL?version=8.0", + "images": [], + "version": "8.0.1.1.0", "application": False, "author": "IT-Projects LLC, Pavel Romanchenko", - "website": "https://it-projects.info", - "license": "GPL-3", + "support": "apps@it-projects.info", + "website": "https://it-projects.info/", + "license": "LGPL-3", "price": 50.00, "currency": "EUR", "depends": [ - "mail", + "mail" ], "external_dependencies": {"python": [], "bin": []}, "data": [ 'template.xml', - 'view.xml', + ], + "demo": [ ], "qweb": [ 'static/src/xml/mail_private.xml', ], - "demo": [], "post_load": None, "pre_init_hook": None, "post_init_hook": None, + "uninstall_hook": None, "auto_install": False, "installable": True, + + # "demo_title": "{MODULE_NAME}", + # "demo_addons": [ + # ], + # "demo_addons_hidden": [ + # ], + # "demo_url": "DEMO-URL", + # "demo_summary": "{SHORT_DESCRIPTION_OF_THE_MODULE}", + # "demo_images": [ + # "images/MAIN_IMAGE", + # ] } diff --git a/mail_private/doc/changelog.rst b/mail_private/doc/changelog.rst index 5f357201..c3f8e2e1 100644 --- a/mail_private/doc/changelog.rst +++ b/mail_private/doc/changelog.rst @@ -1,5 +1,8 @@ -Updates -======= +`1.1.0` +------- + +- **New**: internal users are flagged automatically. +- **New**: added button "Uncheck all". `1.0.0` ------- diff --git a/mail_private/models.py b/mail_private/models.py index 2d4b7ef8..ac968be1 100644 --- a/mail_private/models.py +++ b/mail_private/models.py @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- +# Copyright 2016 manawi +# Copyright 2016 Ivan Yelizariev +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). from openerp.osv import osv, fields diff --git a/mail_private/static/src/css/mail_private.css b/mail_private/static/src/css/mail_private.css new file mode 100644 index 00000000..cacc8265 --- /dev/null +++ b/mail_private/static/src/css/mail_private.css @@ -0,0 +1,8 @@ +.oe_mail .oe_msg_composer .oe_msg_content .oe_composer_uncheck { + margin-top: 3px; + margin-bottom: 15px; + margin-left: 0px; +} +.oe_mail .oe_msg_composer .oe_msg_content .oe_recipients { + margin-left: 0px; +} \ No newline at end of file diff --git a/mail_private/static/src/js/mail_private.js b/mail_private/static/src/js/mail_private.js index bc0d7815..dc7189dd 100644 --- a/mail_private/static/src/js/mail_private.js +++ b/mail_private/static/src/js/mail_private.js @@ -1,3 +1,7 @@ +/* Copyright 2016 x620 + Copyright 2016 Ivan Yelizariev + Copyright 2019 Artem Rafailov + License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */ openerp.mail_private = function(instance){ var mail = instance.mail; @@ -5,11 +9,23 @@ openerp.mail_private = function(instance){ instance.mail.ThreadComposeMessage.include({ init: function (parent, datasets, options) { this._super.apply(this, arguments); + self = this; this.private = false; + self.recipients = []; + }, + on_uncheck_recipients: function () { + this.$(".oe_recipients") + .find("input:checked").each(function() { + $(this).prop('checked', false); + }); + _.each(self.recipients, function(res) { + res['checked'] = false; + }); }, bind_events: function(){ var self = this; this.$('.oe_compose_post_private').on('click', self.on_toggle_quick_composer_private); + this.$('.oe_composer_uncheck').on('click', self.on_uncheck_recipients); this._super.apply(this, arguments); }, on_compose_fullmail: function (default_composition_mode) { @@ -122,7 +138,7 @@ openerp.mail_private = function(instance){ var parsed_email = mail.ChatterUtils.parse_email(recipient[1]); if (_.indexOf(email_addresses, parsed_email[1]) == -1) { self.recipients.push({ - 'checked': false, + 'checked': (recipient[3].length > 0), 'partner_id': recipient[0], 'full_name': recipient[1], 'name': parsed_email[0], @@ -157,7 +173,7 @@ openerp.mail_private = function(instance){ return suggested_partners; } }); - + instance.mail.Thread.include({ get_recipients_for_internal_message: function(ids, context){ var self = this; @@ -187,7 +203,7 @@ openerp.mail_private = function(instance){ reason = 'Partner'; } self.result[res_id].push( - [partner.id, partner.name + '<' + partner.email + '>', reason] + [partner.id, partner.name + '<' + partner.email + '>', reason, partner.user_ids] ); } } diff --git a/mail_private/static/src/xml/mail_private.xml b/mail_private/static/src/xml/mail_private.xml index d603d828..6893eab9 100644 --- a/mail_private/static/src/xml/mail_private.xml +++ b/mail_private/static/src/xml/mail_private.xml @@ -1,4 +1,7 @@ + diff --git a/mail_private/template.xml b/mail_private/template.xml index 534e53c4..b2d52435 100644 --- a/mail_private/template.xml +++ b/mail_private/template.xml @@ -1,4 +1,7 @@ +