Skip to content

Commit

Permalink
⚡ mail_private New: internal users are flagged automatically. Added b…
Browse files Browse the repository at this point in the history
…utton "Uncheck all"
  • Loading branch information
Ommo73 committed Mar 28, 2019
1 parent 9a78eed commit 0df6766
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 13 deletions.
33 changes: 26 additions & 7 deletions mail_private/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,54 @@
# -*- coding: utf-8 -*-
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2016 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# 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": "[email protected]",
"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",
# ]
}
7 changes: 5 additions & 2 deletions mail_private/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Updates
=======
`1.1.0`
-------

- **New**: internal users are flagged automatically.
- **New**: added button "Uncheck all".

`1.0.0`
-------
Expand Down
3 changes: 3 additions & 0 deletions mail_private/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2016 manawi <https://github.com/manawi>
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).

from openerp.osv import osv, fields

Expand Down
8 changes: 8 additions & 0 deletions mail_private/static/src/css/mail_private.css
Original file line number Diff line number Diff line change
@@ -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;
}
22 changes: 19 additions & 3 deletions mail_private/static/src/js/mail_private.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
/* Copyright 2016 x620 <https://github.com/x620>
Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */
openerp.mail_private = function(instance){

var mail = instance.mail;

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) {
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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]
);
}
}
Expand Down
6 changes: 6 additions & 0 deletions mail_private/static/src/xml/mail_private.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->
<template>
<t t-extend="mail.compose_message">
<t t-jquery="a[title='Send a message to all followers of the document']" t-operation="after">
Expand All @@ -17,5 +20,8 @@
</span>
</t>
</t>
<t t-jquery="div[class='oe_recipients']" t-operation="after">
<button class="oe_composer_uncheck" t-if="widget.private">Uncheck all</button>
</t>
</t>
</template>
4 changes: 4 additions & 0 deletions mail_private/template.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Copyright 2016 x620 <https://github.com/x620>
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->
<openerp>
<data>
<template
id="assets_backend"
name="mail_private_assets_backend"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/mail_private/static/src/css/mail_private.css"/>
<script
type="text/javascript"
src="/mail_private/static/src/js/mail_private.js"></script>
Expand Down
5 changes: 4 additions & 1 deletion mail_private/view.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Copyright 2016 x620 <https://github.com/x620>
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->
<openerp>
<data>
<record id="mail_private_email_compose_message_wizard_form" model="ir.ui.view">
Expand All @@ -24,4 +27,4 @@
</field>
</record>
</data>
</openerp>
</openerp>

0 comments on commit 0df6766

Please sign in to comment.