Browse Source

Merge branch '9.0-res_partner_mails_count' of https://github.com/x620/mail-addons into 9.0-mail_reply

pull/21/head
x620 9 years ago
parent
commit
04b5c900ee
  1. 16
      mail_all/README.rst
  2. 3
      mail_all/__init__.py
  3. 28
      mail_all/__openerp__.py
  4. 7
      mail_all/doc/changelog.rst
  5. 9
      mail_all/doc/index.rst
  6. 0
      mail_all/models/__init__.py
  7. BIN
      mail_all/static/description/1.png
  8. BIN
      mail_all/static/description/2.png
  9. BIN
      mail_all/static/description/icon.png
  10. 45
      mail_all/static/description/index.html
  11. 65
      mail_all/static/src/js/mail_all.js
  12. 19
      mail_all/static/src/xml/menu.xml
  13. 3
      mail_all/tests/__init__.py
  14. 15
      mail_all/tests/test_js.py
  15. 12
      mail_all/views/templates.xml
  16. 4
      mail_archives/README.rst
  17. 2
      mail_archives/__init__.py
  18. 4
      mail_archives/__openerp__.py
  19. 30
      mail_archives/static/src/js/archives.js
  20. 13
      mail_base/static/src/js/base.js
  21. 14
      mail_sent/static/src/js/sent.js
  22. 2
      mail_to/doc/index.rst
  23. 4
      res_partner_mails_count/__openerp__.py
  24. 16
      res_partner_mails_count/static/src/js/res_partner_mails_count_tour.js
  25. 3
      res_partner_mails_count/templates.xml
  26. 2
      res_partner_mails_count/views/res_partner_mails_count.xml

16
mail_all/README.rst

@ -0,0 +1,16 @@
===================
Show all messages
===================
Adds ``Discuss / All`` menu, that shows all messages accesable by current user
Further information
-------------------
HTML Description: https://apps.odoo.com/apps/modules/9.0/mail_all/
Usage instructions: `<doc/index.rst>`_
Changelog: `<doc/changelog.rst>`_
Tested on Odoo 9.0 d3dd4161ad0598ebaa659fbd083457c77aa9448d

3
mail_all/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import models

28
mail_all/__openerp__.py

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
{
"name": "Show all messages",
"summary": """Checkout all messages where you have access""",
"category": "Discuss",
"images": [],
"version": "1.0.0",
"author": "IT-Projects LLC, Pavel Romanchenko",
"website": "https://it-projects.info",
"license": "LGPL-3",
'price': 40.00,
'currency': 'EUR',
"depends": [
"mail_base"
],
"external_dependencies": {"python": [], "bin": []},
"data": [
"views/templates.xml",
],
"qweb": [
"static/src/xml/menu.xml",
],
"demo": [],
'installable': True,
"auto_install": False,
}

7
mail_all/doc/changelog.rst

@ -0,0 +1,7 @@
Changelog
=========
`1.0.0`
-------
- Init version

9
mail_all/doc/index.rst

@ -0,0 +1,9 @@
===================
Show all messages
===================
Usage
=====
* Open menu ``Discuss / All messages``
* You see all messages

0
mail_archives/models/__init__.py → mail_all/models/__init__.py

BIN
mail_all/static/description/1.png

After

Width: 300  |  Height: 270  |  Size: 15 KiB

BIN
mail_all/static/description/2.png

After

Width: 765  |  Height: 400  |  Size: 22 KiB

BIN
mail_all/static/description/icon.png

After

Width: 100  |  Height: 100  |  Size: 2.1 KiB

45
mail_all/static/description/index.html

@ -0,0 +1,45 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Show all messages</h2>
<h3 class="oe_slogan">Checkout all messages where you have access</h3>
</div>
<div class="oe_span6">
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="1.png"/>
</div>
</div>
<div class="oe_span6">
<p class="oe_mt32">
The module adds usual menu.
</p>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<p class="oe_mt32">
This menu shows all messages.
</p>
</div>
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="2.png"/>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2>Need our service?</h2>
<p class="oe_mt32">Contact us by <a href="mailto:it@it-projects.info">email</a> or fill out <a href="https://www.it-projects.info/page/website.contactus " target="_blank">request form</a></p>
<ul>
<li><a href="mailto:it@it-projects.info">it@it-projects.info <i class="fa fa-envelope-o"></i></a></li>
<li><a href="https://www.it-projects.info/page/website.contactus " target="_blank">
https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li>
</ul>
</div>
</div>
</section>

65
mail_all/static/src/js/mail_all.js

@ -0,0 +1,65 @@
odoo.define('mail_all.all', function (require) {
"use strict";
var base_obj = require('mail_base.base');
//-------------------------------------------------------------------------------
var bus = require('bus.bus').bus;
var config = require('web.config');
var core = require('web.core');
var data = require('web.data');
var Model = require('web.Model');
var session = require('web.session');
var time = require('web.time');
var web_client = require('web.web_client');
var _lt = core._lt;
//-------------------------------------------------------------------------------
var ChatAction = core.action_registry.get('mail.chat.instant_messaging');
ChatAction.include({
get_thread_rendering_options: function (messages) {
var options = this._super.apply(this, arguments);
options.display_subject = options.display_subject || this.channel.id === "channel_all";
return options;
}
});
// Inherit class and override methods
base_obj.MailTools.include({
get_properties: function(msg){
var properties = this._super.apply(this, arguments);
properties.is_all = this.property_descr("channel_all", msg, this);
return properties;
},
set_channel_flags: function(data, msg){
this._super.apply(this, arguments);
msg.is_all = true;
return msg;
},
get_channel_array: function(msg){
var arr = this._super.apply(this, arguments);
return arr.concat('channel_all');
},
get_domain: function(channel){
return (channel.id === "channel_all") ? [] : this._super.apply(this, arguments);
}
});
base_obj.chat_manager.is_ready.then(function(){
// Add all channel
base_obj.chat_manager.mail_tools.add_channel({
id: "channel_all",
name: _lt("All messages"),
type: "static"
});
return $.when();
});
return base_obj.chat_manager;
});

19
mail_all/static/src/xml/menu.xml

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<!--Inherit Sidebar and add All messages menu item after Starred -->
<t t-extend="mail.chat.Sidebar">
<t t-jquery="div[data-channel-id=channel_starred]" t-operation="after">
<div t-attf-class="o_mail_chat_channel_item #{(active_channel_id == 'channel_all') ? 'o_active': ''}" data-channel-id="channel_all">
<span class="o_channel_name mail_all"> <i class="fa fa-database"/> All messages </span>
</div>
</t>
</t>
<!--Add message about empty all messages page-->
<t t-extend="mail.EmptyChannel">
<t t-jquery="t:last-child" t-operation="after">
<t t-if="options.channel_id==='channel_all'">
<div class="o_thread_title">No messages</div>
</t>
</t>
</t>
</template>

3
mail_all/tests/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
import test_js

15
mail_all/tests/test_js.py

@ -0,0 +1,15 @@
import openerp.tests
@openerp.tests.common.at_install(False)
@openerp.tests.common.post_install(True)
class TestUi(openerp.tests.HttpCase):
def test_01_mail_all(self):
# wait till page loaded and then click and wait again
code = """
setTimeout(function () {
$(".mail_all").click();
setTimeout(function () {console.log('ok');}, 3000);
}, 1000);
"""
link = '/web#action=%s' % self.ref('mail.mail_channel_action_client_chat')
self.phantom_js(link, code, "odoo.__DEBUG__.services['mail_all.all']", login="admin")

12
mail_all/views/templates.xml

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<openerp>
<data>
<template id="mail_all_assets_backend"
name="mail_all_assets_backend"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script src="/mail_all/static/src/js/mail_all.js" type="text/javascript"></script>
</xpath>
</template>
</data>
</openerp>

4
mail_archives/README.rst

@ -1,11 +1,11 @@
Mail Archives Mail Archives
============= =============
Adds Archive menu, which shows all messages
Adds Archive menu, which shows sent/received messages
Usage Usage
----- -----
Click Discuss/Archive menu -- all messages are displayed
Click Discuss/Archive menu -- sent/received messages are displayed
Further information Further information
------------------- -------------------

2
mail_archives/__init__.py

@ -1,3 +1 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from . import models

4
mail_archives/__openerp__.py

@ -13,9 +13,7 @@
'currency': 'EUR', 'currency': 'EUR',
"depends": [ "depends": [
"base",
"mail",
"mail_base"
"mail_sent",
], ],
"data": [ "data": [

30
mail_archives/static/src/js/archives.js

@ -16,6 +16,15 @@ var web_client = require('web.web_client');
var _lt = core._lt; var _lt = core._lt;
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
var ChatAction = core.action_registry.get('mail.chat.instant_messaging');
ChatAction.include({
get_thread_rendering_options: function (messages) {
var options = this._super.apply(this, arguments);
options.display_subject = options.display_subject || this.channel.id === "channel_archive";
return options;
}
});
// Inherit class and override methods // Inherit class and override methods
base_obj.MailTools.include({ base_obj.MailTools.include({
get_properties: function(msg){ get_properties: function(msg){
@ -26,7 +35,20 @@ base_obj.MailTools.include({
set_channel_flags: function(data, msg){ set_channel_flags: function(data, msg){
this._super.apply(this, arguments); this._super.apply(this, arguments);
msg.is_archive = true;
// Get recipients ids
var recipients_ids = [];
for (var i = 0; i < data.partner_ids.length; i++){
recipients_ids.push(data.partner_ids[i][0]);
}
// If author or recipient
if (
(data.sent && data.author_id[0] == session.partner_id)
|| (recipients_ids.indexOf(session.partner_id) != -1)
) {
msg.is_archive = true;
}
return msg; return msg;
}, },
@ -36,7 +58,11 @@ base_obj.MailTools.include({
}, },
get_domain: function(channel){ get_domain: function(channel){
return (channel.id === "channel_archive") ? [] : this._super.apply(this, arguments);
return (channel.id === "channel_archive") ? [
'|', ['partner_ids', 'in', [openerp.session.partner_id]],
'&', ['sent', '=', true],
['author_id.user_ids', 'in', [openerp.session.uid]]
] : this._super.apply(this, arguments);
} }
}); });

13
mail_base/static/src/js/base.js

@ -63,6 +63,10 @@ var channel_seen = _.throttle(function (channel) {
var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); var ChatAction = core.action_registry.get('mail.chat.instant_messaging');
ChatAction.include({ ChatAction.include({
init: function(parent, action, options) {
this._super.apply(this, arguments);
this.show_send_message_button = ['channel_inbox'];
},
start: function() { start: function() {
var result = this._super.apply(this, arguments); var result = this._super.apply(this, arguments);
@ -93,6 +97,15 @@ ChatAction.include({
} }
}); });
return result; return result;
},
set_channel: function(channel){
var result = this._super.apply(this, arguments);
var self = this;
return $.when(result).done(function() {
self.$buttons
.find('.o_mail_chat_button_new_message')
.toggle(self.show_send_message_button.indexOf(channel.id) != -1);
});
} }
}); });

14
mail_sent/static/src/js/sent.js

@ -16,6 +16,20 @@ var web_client = require('web.web_client');
var _lt = core._lt; var _lt = core._lt;
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
var ChatAction = core.action_registry.get('mail.chat.instant_messaging');
ChatAction.include({
init: function(parent, action, options) {
this._super.apply(this, arguments);
// Add channel Sent for show "Send message" button
this.show_send_message_button.push('channel_sent');
},
get_thread_rendering_options: function (messages) {
var options = this._super.apply(this, arguments);
options.display_subject = options.display_subject || this.channel.id === "channel_sent";
return options;
}
});
// Inherit class and override methods // Inherit class and override methods
base_obj.MailTools.include({ base_obj.MailTools.include({
get_properties: function(msg){ get_properties: function(msg){

2
mail_to/doc/index.rst

@ -9,4 +9,4 @@ Usage
* Many messages have Recipients info. * Many messages have Recipients info.
* Click Inbox left menu item, click Send mail button, set recipient and send message. This message will show recipient. * Click Inbox left menu item, click Send mail button, set recipient and send message. This message will show recipient.
* To see the recipient's need hover the mouse over a message. * To see the recipient's need hover the mouse over a message.
* For messages created before install module it will not work where the recipients is not set there is not way restore recipients value.
* For messages created before install module it will not work where the recipients are not set. There is no way to restore recipients value.

4
res_partner_mails_count/__openerp__.py

@ -13,8 +13,8 @@
"currency": "EUR", "currency": "EUR",
"depends": [ "depends": [
'mail_archives',
'web_tour_extra' ,
'mail_all',
'web_tour_extra',
], ],
"external_dependencies": {"python": [], "bin": []}, "external_dependencies": {"python": [], "bin": []},
"data": [ "data": [

16
res_partner_mails_count/static/src/js/res_partner_mails_count_tour.js

@ -22,17 +22,13 @@ odoo.define('res_partner_mails_count.res_partner_mails_count_tour', function (re
waitFor: '.mails_to:visible', waitFor: '.mails_to:visible',
}, },
{ {
title: _t("Messages are found!"),
title: _t("Done"),
placement: 'top', placement: 'top',
waitNot: '.mails_to:visible',
element: '.o_mail_thread',
},
{
wait: '5000',
waitFor: '.o_channel_name.mail_archives:visible',
title: _t("That's it"),
content: _t("Enjoy your day! <br/> <br/><a href='https://www.it-projects.info/apps' target='_blank'>IT-Projects LLC</a> team "),
popover: { next: _t("Close Tutorial") },
waitNot: '.mails_to:visible',
waitFor: '.o_mail_thread',
element: '.o_mail_thread',
content: _t("Message are found. <br/>Enjoy your day! <br/> <br/><a href='https://www.it-projects.info/apps' target='_blank'>IT-Projects LLC</a> team "),
popover: {next: _t("Close Tutorial")},
}, },
] ]
}); });

3
res_partner_mails_count/templates.xml

@ -40,7 +40,8 @@
<record id="base.open_menu" model="ir.actions.todo"> <record id="base.open_menu" model="ir.actions.todo">
<field name="action_id" ref="res_partner_mails_count_tutorial"/> <field name="action_id" ref="res_partner_mails_count_tutorial"/>
<field name="state">open</field> <field name="state">open</field>
<field name="sequence">200</field>
<field name="sequence">500</field>
<field name="type">automatic</field>
</record> </record>
</data> </data>
</openerp> </openerp>

2
res_partner_mails_count/views/res_partner_mails_count.xml

@ -6,7 +6,7 @@
<field name="tag">mail.chat.instant_messaging</field> <field name="tag">mail.chat.instant_messaging</field>
<field name="res_model">mail.message</field> <field name="res_model">mail.message</field>
<field name="context">{ <field name="context">{
'active_id': 'channel_archive'
'active_id': 'channel_all'
}</field> }</field>
<field name="help" type="html"> <field name="help" type="html">
<p> <p>

Loading…
Cancel
Save