Merge pull request #4 from yelizariev/9.0-res_partner_mails_count
9.0 res partner mails countpull/24/head
-
16mail_all/README.rst
-
3mail_all/__init__.py
-
28mail_all/__openerp__.py
-
7mail_all/doc/changelog.rst
-
9mail_all/doc/index.rst
-
1mail_all/models/__init__.py
-
BINmail_all/static/description/1.png
-
BINmail_all/static/description/2.png
-
BINmail_all/static/description/icon.png
-
45mail_all/static/description/index.html
-
65mail_all/static/src/js/mail_all.js
-
19mail_all/static/src/xml/menu.xml
-
3mail_all/tests/__init__.py
-
15mail_all/tests/test_js.py
-
12mail_all/views/templates.xml
-
15mail_archives/README.rst
-
1mail_archives/__init__.py
-
26mail_archives/__openerp__.py
-
BINmail_archives/images/1.jpg
-
BINmail_archives/static/description/1.png
-
BINmail_archives/static/description/2.png
-
BINmail_archives/static/description/icon.png
-
45mail_archives/static/description/index.html
-
79mail_archives/static/src/js/archives.js
-
19mail_archives/static/src/xml/menu.xml
-
3mail_archives/tests/__init__.py
-
15mail_archives/tests/test_js.py
-
12mail_archives/views/templates.xml
-
19mail_base/README.rst
-
3mail_base/__init__.py
-
24mail_base/__openerp__.py
-
18mail_base/models.py
-
1140mail_base/static/src/js/base.js
-
12mail_base/views/templates.xml
-
2mail_fix_553/README.rst
-
12mail_sent/README.rst
-
2mail_sent/__init__.py
-
37mail_sent/__openerp__.py
-
40mail_sent/models.py
-
BINmail_sent/static/description/menu.png
-
BINmail_sent/static/description/messages.png
-
73mail_sent/static/src/js/sent.js
-
20mail_sent/static/src/xml/menu.xml
-
3mail_sent/tests/__init__.py
-
15mail_sent/tests/test_js.py
-
38mail_sent/views.xml
-
12mail_sent/views/templates.xml
-
11mail_to/README.rst
-
1mail_to/__init__.py
-
28mail_to/__openerp__.py
-
7mail_to/doc/changelog.rst
-
12mail_to/doc/index.rst
-
23mail_to/static/src/css/mail_to.css
-
29mail_to/static/src/js/mail_to.js
-
22mail_to/static/src/xml/recipient.xml
-
13mail_to/templates.xml
-
16res_partner_mails_count/README.rst
-
2res_partner_mails_count/__init__.py
-
28res_partner_mails_count/__openerp__.py
-
BINres_partner_mails_count/images/1.png
-
19res_partner_mails_count/models.py
-
BINres_partner_mails_count/static/description/1.png
-
BINres_partner_mails_count/static/description/2.png
-
BINres_partner_mails_count/static/description/3.png
-
BINres_partner_mails_count/static/description/icon.png
-
34res_partner_mails_count/static/description/index.html
-
36res_partner_mails_count/static/src/js/res_partner_mails_count_tour.js
-
47res_partner_mails_count/templates.xml
-
4res_partner_mails_count/tests/__init__.py
-
33res_partner_mails_count/tests/test_mail.py
-
19res_partner_mails_count/tests/test_phantom.py
-
18res_partner_mails_count/views/res_partner_mails_count.xml
@ -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 |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import models |
@ -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, |
|||
} |
@ -0,0 +1,7 @@ |
|||
Changelog |
|||
========= |
|||
|
|||
`1.0.0` |
|||
------- |
|||
|
|||
- Init version |
@ -0,0 +1,9 @@ |
|||
=================== |
|||
Show all messages |
|||
=================== |
|||
|
|||
Usage |
|||
===== |
|||
|
|||
* Open menu ``Discuss / All messages`` |
|||
* You see all messages |
@ -0,0 +1 @@ |
|||
# -*- coding: utf-8 -*- |
After Width: 300 | Height: 270 | Size: 15 KiB |
After Width: 765 | Height: 400 | Size: 22 KiB |
After Width: 100 | Height: 100 | Size: 2.1 KiB |
@ -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> |
@ -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; |
|||
|
|||
}); |
@ -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> |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
import test_js |
@ -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") |
@ -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> |
@ -0,0 +1,15 @@ |
|||
Mail Archives |
|||
============= |
|||
|
|||
Adds Archive menu, which shows sent/received messages |
|||
|
|||
Usage |
|||
----- |
|||
Click Discuss/Archive menu -- sent/received messages are displayed |
|||
|
|||
Further information |
|||
------------------- |
|||
|
|||
HTML Description: https://apps.odoo.com/apps/modules/9.0/mail_archives/ |
|||
|
|||
Tested on Odoo 9.0 b9f206953e3f877adf18643f154d1262842564ee |
@ -0,0 +1 @@ |
|||
# -*- coding: utf-8 -*- |
@ -0,0 +1,26 @@ |
|||
# -*- coding: utf-8 -*- |
|||
{ |
|||
"name": "Mail archives", |
|||
"summary": """Adds menu to find old messages""", |
|||
"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", |
|||
], |
|||
|
|||
"data": [ |
|||
"views/templates.xml", |
|||
], |
|||
"qweb": [ |
|||
"static/src/xml/menu.xml", |
|||
], |
|||
'installable': True, |
|||
} |
After Width: 334 | Height: 171 | Size: 18 KiB |
After Width: 300 | Height: 270 | Size: 24 KiB |
After Width: 765 | Height: 400 | Size: 40 KiB |
After Width: 100 | Height: 100 | Size: 2.1 KiB |
@ -0,0 +1,45 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<h2 class="oe_slogan">Look up old mails</h2> |
|||
<h3 class="oe_slogan">Browse archived mails like in odoo 8</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 archive messages, i.e. ones you sent or received. |
|||
</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> |
@ -0,0 +1,79 @@ |
|||
odoo.define('mail_archives.archives', 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({ |
|||
init: function(parent, action, options) { |
|||
this._super.apply(this, arguments); |
|||
var channel_name = 'channel_archive'; |
|||
// Add channel Archive for enable "display_subject" option
|
|||
this.channels_display_subject.push(channel_name); |
|||
} |
|||
}); |
|||
|
|||
// Inherit class and override methods
|
|||
base_obj.MailTools.include({ |
|||
get_properties: function(msg){ |
|||
var properties = this._super.apply(this, arguments); |
|||
properties.is_archive = this.property_descr("channel_archive", msg, this); |
|||
return properties; |
|||
}, |
|||
|
|||
set_channel_flags: function(data, msg){ |
|||
this._super.apply(this, arguments); |
|||
// 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.author_id[0] == session.partner_id || recipients_ids.indexOf(session.partner_id) != -1) { |
|||
msg.is_archive = true; |
|||
} |
|||
|
|||
return msg; |
|||
}, |
|||
|
|||
get_channel_array: function(msg){ |
|||
var arr = this._super.apply(this, arguments); |
|||
return arr.concat('channel_archive'); |
|||
}, |
|||
|
|||
get_domain: function(channel){ |
|||
return (channel.id === "channel_archive") ? [ |
|||
'|', ['partner_ids', 'in', [openerp.session.partner_id]], |
|||
['author_id.user_ids', 'in', [openerp.session.uid]] |
|||
] : this._super.apply(this, arguments); |
|||
} |
|||
}); |
|||
|
|||
base_obj.chat_manager.is_ready.then(function(){ |
|||
// Add archive channel
|
|||
base_obj.chat_manager.mail_tools.add_channel({ |
|||
id: "channel_archive", |
|||
name: _lt("Archive"), |
|||
type: "static" |
|||
}); |
|||
|
|||
return $.when(); |
|||
}); |
|||
|
|||
return base_obj.chat_manager; |
|||
|
|||
}); |
@ -0,0 +1,19 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<template> |
|||
<!--Inherit Sidebar and add Archive 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_archive') ? 'o_active': ''}" data-channel-id="channel_archive"> |
|||
<span class="o_channel_name mail_archives"> <i class="fa fa-archive"/> Archive </span> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
<!--Add message about empty archive page--> |
|||
<t t-extend="mail.EmptyChannel"> |
|||
<t t-jquery="t:last-child" t-operation="after"> |
|||
<t t-if="options.channel_id==='channel_archive'"> |
|||
<div class="o_thread_title">Archive is empty</div> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</template> |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
import test_js |
@ -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_archives(self): |
|||
# wait till page loaded and then click and wait again |
|||
code = """ |
|||
setTimeout(function () { |
|||
$(".mail_archives").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_archives.archives']", login="admin") |
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0"?> |
|||
<openerp> |
|||
<data> |
|||
<template id="res_partner_mails_count_assets_backend" |
|||
name="res_partner_mails_count_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
<xpath expr="." position="inside"> |
|||
<script src="/mail_archives/static/src/js/archives.js" type="text/javascript"></script> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,19 @@ |
|||
Mail Base |
|||
========= |
|||
|
|||
* makes built-in mail js features extendable. |
|||
* handles ``search_default_*`` parameters in context. |
|||
* fixes toggling left bar |
|||
* fixes Recipients field. Out-of-box this field could be empty. |
|||
|
|||
Usage |
|||
----- |
|||
To use this module you need either install module that depends on it or create new module. |
|||
|
|||
Further information |
|||
------------------- |
|||
Due to odoo restrictions, module makes mail initialization again. That is browser loads emoji and other chat data twice. This is the only way to make Mail feature extendable. |
|||
|
|||
One can say, that the module do this todo from `addons/mail/static/src/js/chat_manager.js <https://github.com/odoo/odoo/blob/9.0/addons/mail/static/src/js/chat_manager.js#L57>`_ |
|||
|
|||
// to do: move this to mail.utils |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
import models |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
{ |
|||
"name": "Mail Base", |
|||
"summary": """Makes Mail extendable""", |
|||
"category": "Discuss", |
|||
"images": [], |
|||
"version": "1.0.0", |
|||
|
|||
"author": "IT-Projects LLC, Pavel Romanchenko", |
|||
"website": "https://it-projects.info", |
|||
"license": "LGPL-3", |
|||
'price': 9.00, |
|||
'currency': 'EUR', |
|||
|
|||
"depends": [ |
|||
"base", |
|||
"mail" |
|||
], |
|||
|
|||
"data": [ |
|||
"views/templates.xml", |
|||
], |
|||
'installable': True, |
|||
} |
@ -0,0 +1,18 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from openerp import api, models |
|||
|
|||
|
|||
class MailMessage(models.Model): |
|||
_inherit = 'mail.message' |
|||
|
|||
@api.multi |
|||
def write(self, values): |
|||
if values.get('needaction_partner_ids'): |
|||
if not values.get('partner_ids'): |
|||
values['partner_ids'] = [] |
|||
for triplet in values.get('needaction_partner_ids'): |
|||
if triplet[0] == 6: |
|||
for id in triplet[2]: |
|||
values['partner_ids'].append((4, id, False)) |
|||
return super(MailMessage, self).write(values) |
1140
mail_base/static/src/js/base.js
File diff suppressed because it is too large
View File
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0"?> |
|||
<openerp> |
|||
<data> |
|||
<template id="mail_base_assets_backend" |
|||
name="mail_base_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
<xpath expr="." position="inside"> |
|||
<script src="/mail_base/static/src/js/base.js" type="text/javascript"></script> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
</openerp> |
@ -1,8 +1,16 @@ |
|||
Sentbox |
|||
======= |
|||
|
|||
Description: https://apps.odoo.com/apps/modules/8.0/mail_sent/ |
|||
Adds Sent menu, which shows sent messages |
|||
|
|||
Usage |
|||
----- |
|||
Click Discuss/Sent menu -- sent messages are displayed |
|||
|
|||
Further information |
|||
------------------- |
|||
Further information and discussion: https://yelizariev.github.io/odoo/module/2015/02/19/sentbox.html |
|||
|
|||
Tested on Odoo 8.0 231e02693640325c9a05fa31c680063b9e4b017b |
|||
HTML Description: https://apps.odoo.com/apps/modules/9.0/mail_sent/ |
|||
|
|||
Tested on Odoo 9.0 b9f206953e3f877adf18643f154d1262842564ee |
@ -1 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
import models |
@ -1,15 +1,28 @@ |
|||
# -*- coding: utf-8 -*- |
|||
{ |
|||
'name' : 'Sentbox', |
|||
'version' : '1.0.2', |
|||
'author' : 'IT-Projects LLC, Ivan Yelizariev', |
|||
'license': 'LGPL-3', |
|||
'category' : 'Social Network', |
|||
'website' : 'https://twitter.com/yelizariev', |
|||
'price': 9.00, |
|||
"name": "Sentbox", |
|||
"summary": """Quick way to find sent messages""", |
|||
"category": "Discuss", |
|||
"images": [], |
|||
"version": "1.0.3", |
|||
|
|||
"author": "IT-Projects LLC, Ivan Yelizariev, Pavel Romanchenko", |
|||
"website": "https://it-projects.info", |
|||
"license": "LGPL-3", |
|||
'price': 40.00, |
|||
'currency': 'EUR', |
|||
'depends' : ['mail'], |
|||
'data':[ |
|||
'views.xml', |
|||
], |
|||
'installable': False |
|||
|
|||
"depends": [ |
|||
"base", |
|||
"mail", |
|||
"mail_base" |
|||
], |
|||
|
|||
"data": [ |
|||
"views/templates.xml", |
|||
], |
|||
"qweb": [ |
|||
"static/src/xml/menu.xml", |
|||
], |
|||
'installable': True, |
|||
} |
@ -1,28 +1,32 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from openerp import api, models, fields |
|||
|
|||
|
|||
class mail_message(models.Model): |
|||
class MailMessage(models.Model): |
|||
_inherit = 'mail.message' |
|||
|
|||
sent = fields.Boolean('Sent', compute="_get_sent", help='Was message sent to someone', store=True) |
|||
|
|||
@api.one |
|||
@api.depends('author_id', 'notified_partner_ids') |
|||
@api.depends('author_id', 'partner_ids') |
|||
def _get_sent(self): |
|||
self_sudo = self.sudo() |
|||
self_sudo.sent = len(self_sudo.notified_partner_ids) > 1 or len(self_sudo.notified_partner_ids) == 1 and self_sudo.author_id and self_sudo.notified_partner_ids[0].id != self_sudo.author_id.id |
|||
|
|||
sent = fields.Boolean('Sent', compute=_get_sent, help='Was message sent to someone', store=True) |
|||
|
|||
|
|||
class mail_notification(models.Model): |
|||
_inherit = 'mail.notification' |
|||
|
|||
def _notify(self, cr, uid, message_id, **kwargs): |
|||
super(mail_notification, self)._notify(cr, uid, message_id, **kwargs) |
|||
self.pool['mail.message'].browse(cr, uid, message_id)._get_sent() |
|||
|
|||
|
|||
class mail_compose_message(models.TransientModel): |
|||
|
|||
self_sudo.sent = len(self_sudo.partner_ids) > 1 \ |
|||
or len(self_sudo.partner_ids) == 1 \ |
|||
and self_sudo.author_id \ |
|||
and self_sudo.partner_ids[0].id != self_sudo.author_id.id |
|||
|
|||
@api.multi |
|||
def message_format(self): |
|||
message_values = super(MailMessage, self).message_format() |
|||
message_index = {message['id']: message for message in message_values} |
|||
for item in self: |
|||
msg = message_index.get(item.id) |
|||
if msg: |
|||
msg['sent'] = item.sent |
|||
return message_values |
|||
|
|||
|
|||
class MailComposeMessage(models.TransientModel): |
|||
_inherit = 'mail.compose.message' |
|||
sent = fields.Boolean('Sent', help='dummy field to fix inherit error') |
|||
|
Before Width: 217 | Height: 167 | Size: 5.8 KiB After Width: 217 | Height: 167 | Size: 8.9 KiB |
Before Width: 625 | Height: 217 | Size: 37 KiB After Width: 625 | Height: 217 | Size: 39 KiB |
@ -0,0 +1,73 @@ |
|||
odoo.define('mail_sent.sent', 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({ |
|||
init: function(parent, action, options) { |
|||
this._super.apply(this, arguments); |
|||
var channel_name = 'channel_sent'; |
|||
// Add channel Sent for show "Send message" button
|
|||
this.channels_show_send_button.push(channel_name); |
|||
// Add channel Sent for enable "display_subject" option
|
|||
this.channels_display_subject.push(channel_name); |
|||
} |
|||
}); |
|||
|
|||
// Inherit class and override methods
|
|||
base_obj.MailTools.include({ |
|||
get_properties: function(msg){ |
|||
var properties = this._super.apply(this, arguments); |
|||
properties.is_sent = this.property_descr("channel_sent", msg, this); |
|||
return properties; |
|||
}, |
|||
|
|||
set_channel_flags: function(data, msg){ |
|||
this._super.apply(this, arguments); |
|||
if (data.sent && data.author_id[0] == session.partner_id) { |
|||
msg.is_sent = true; |
|||
} |
|||
return msg; |
|||
}, |
|||
|
|||
get_channel_array: function(msg){ |
|||
var arr = this._super.apply(this, arguments); |
|||
return arr.concat('channel_sent'); |
|||
}, |
|||
|
|||
get_domain: function(channel){ |
|||
return (channel.id === "channel_sent") ? [ |
|||
['sent', '=', true], |
|||
['author_id.user_ids', 'in', [openerp.session.uid]] |
|||
] : this._super.apply(this, arguments); |
|||
} |
|||
}); |
|||
|
|||
base_obj.chat_manager.is_ready.then(function(){ |
|||
// Add sent channel
|
|||
base_obj.chat_manager.mail_tools.add_channel({ |
|||
id: "channel_sent", |
|||
name: _lt("Sent"), |
|||
type: "static" |
|||
}); |
|||
|
|||
return $.when(); |
|||
}); |
|||
|
|||
return base_obj.chat_manager; |
|||
|
|||
}); |
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<template> |
|||
<!--Inherit Sidebar and add Sent menu item after Starred --> |
|||
<t t-extend="mail.chat.Sidebar"> |
|||
<t t-jquery="div[data-channel-id=channel_inbox]" t-operation="after"> |
|||
<div t-attf-class="o_mail_chat_channel_item #{(active_channel_id == 'channel_sent') ? 'o_active': ''}" data-channel-id="channel_sent"> |
|||
<span class="o_channel_name mail_sent"> <i class="fa fa-send-o"/> Sent </span> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
<!--Add message about empty sent page--> |
|||
<t t-extend="mail.EmptyChannel"> |
|||
<t t-jquery="t:last-child" t-operation="after"> |
|||
<t t-if="options.channel_id==='channel_sent'"> |
|||
<div class="o_thread_title">No sent messages</div> |
|||
<div>You can send messages and then these messages will appear here.</div> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</template> |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
import test_js |
@ -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_sent(self): |
|||
# wait till page loaded and then click and wait again |
|||
code = """ |
|||
setTimeout(function () { |
|||
$(".mail_sent").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_sent.sent']", login="demo") |
@ -1,38 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
<record id="action_mail_sent_feeds" model="ir.actions.client"> |
|||
<field name="name">Sent</field> |
|||
<field name="tag">mail.wall</field> |
|||
<field name="context">{ |
|||
'default_model': 'res.users', |
|||
'default_res_id': uid, |
|||
'thread_model': 'res.partner', |
|||
'needaction_menu_ref': ['mail.mail_tomefeeds', 'mail.mail_starfeeds', 'mail.mail_inboxfeeds'] |
|||
}</field> |
|||
<field name="params" eval=""{ |
|||
'domain': [ |
|||
('author_id.user_ids', 'in', [uid]), |
|||
('sent', '=', True), |
|||
], |
|||
'view_mailbox': True, |
|||
'show_compose_message': False |
|||
}""/> |
|||
<field name="help" type="html"> |
|||
<p> |
|||
No message found and no message sent yet. |
|||
</p><p> |
|||
Click on the top-right icon to compose a message. This |
|||
message will be sent by email if it's an internal contact. |
|||
</p> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="mail_sentfeeds" model="ir.ui.menu"> |
|||
<field name="name">Sent</field> |
|||
<field name="sequence" eval="10"/> |
|||
<field name="action" ref="action_mail_sent_feeds"/> |
|||
<field name="parent_id" ref="mail.mail_feeds"/> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0"?> |
|||
<openerp> |
|||
<data> |
|||
<template id="mail_sent_assets_backend" |
|||
name="mail_sent_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
<xpath expr="." position="inside"> |
|||
<script src="/mail_sent/static/src/js/sent.js" type="text/javascript"></script> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,11 @@ |
|||
========================= |
|||
Show message recipients |
|||
========================= |
|||
|
|||
Allows you be sure, that all discussion participants were notified. Adds recipients label the right of message. |
|||
|
|||
Further information |
|||
------------------- |
|||
HTML Description: https://apps.odoo.com/apps/modules/9.0/mail_to/ |
|||
|
|||
Tested on Odoo 9.0 d3dd4161ad0598ebaa659fbd083457c77aa9448d |
@ -0,0 +1 @@ |
|||
# -*- coding: utf-8 -*- |
@ -0,0 +1,28 @@ |
|||
# -*- coding: utf-8 -*- |
|||
{ |
|||
"name": """Show message recipients""", |
|||
"summary": """Allows you be sure, that all discussion participants were notified""", |
|||
"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": [ |
|||
'templates.xml', |
|||
], |
|||
"qweb": [ |
|||
'static/src/xml/recipient.xml', |
|||
], |
|||
"demo": [], |
|||
"installable": True, |
|||
"auto_install": False, |
|||
} |
@ -0,0 +1,7 @@ |
|||
Changelog |
|||
========= |
|||
|
|||
`1.0.0` |
|||
------- |
|||
|
|||
- Init version |
@ -0,0 +1,12 @@ |
|||
========================= |
|||
Show message recipients |
|||
========================= |
|||
|
|||
Usage |
|||
===== |
|||
|
|||
* Open Discuss menu. |
|||
* Many messages have Recipients info. |
|||
* 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. |
|||
* For messages created before install module it will not work where the recipients are not set. There is no way to restore recipients value. |
@ -0,0 +1,23 @@ |
|||
.recipient_link { |
|||
color: grey; |
|||
} |
|||
.recipient_link:hover { |
|||
color: #0d0d0d; |
|||
} |
|||
|
|||
.o_mail_thread .o_thread_message span.recipients_info, |
|||
.o_mail_thread .o_thread_message i.o_thread_message_star, |
|||
.o_mail_thread .o_thread_message i.o_thread_message_reply, |
|||
.o_mail_thread .o_thread_message i.o_thread_message_needaction { |
|||
opacity: 0.4; |
|||
} |
|||
|
|||
.o_mail_thread .o_thread_message:hover i.o_thread_message_star, |
|||
.o_mail_thread .o_thread_message:hover i.o_thread_message_reply, |
|||
.o_mail_thread .o_thread_message:hover i.o_thread_message_needaction { |
|||
opacity: 0.7; |
|||
} |
|||
|
|||
.o_mail_thread .o_thread_message:hover span.recipients_info { |
|||
opacity: 1; |
|||
} |
@ -0,0 +1,29 @@ |
|||
odoo.define('mail_to.MailTo', function (require) { |
|||
"use strict"; |
|||
|
|||
var base_obj = require('mail_base.base'); |
|||
|
|||
base_obj.MailTools.include({ |
|||
make_message: function(data){ |
|||
var msg = this._super(data); |
|||
msg.partner_ids = data.partner_ids; |
|||
// msg.needaction_partner_ids = data.needaction_partner_ids;
|
|||
|
|||
var more_recipients = ''; |
|||
// value which define more recipients
|
|||
msg.more_recipients_value = 4; |
|||
for (var i = 0; i < msg.partner_ids.length; i++){ |
|||
if (i >= msg.more_recipients_value){ |
|||
// append names
|
|||
more_recipients += msg.partner_ids[i][1]; |
|||
// separate them with semicolon
|
|||
if (i < msg.partner_ids.length - 1){ |
|||
more_recipients += '; '; |
|||
} |
|||
} |
|||
} |
|||
msg.more_recipients = more_recipients; |
|||
return msg; |
|||
} |
|||
}); |
|||
}); |
@ -0,0 +1,22 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<template> |
|||
<t t-extend="mail.ChatThread.Message"> |
|||
<t t-jquery="p[class=o_mail_info]>span" t-operation="after"> |
|||
<span class="recipients_info"> |
|||
<t t-if="message.partner_ids.length > 0">To: </t> |
|||
<t t-foreach="message.partner_ids.length" t-as="i"> |
|||
<t t-if="i < message.more_recipients_value"> |
|||
<a t-att-href="_.str.sprintf('/web?#id=%s&view_type=form&model=res.partner', message.partner_ids[i][0])" class="recipient_link"> |
|||
<i t-esc="message.partner_ids[i][1]"/><t t-if="i < message.partner_ids.length - 1">; </t> |
|||
</a> |
|||
</t> |
|||
</t> |
|||
<t t-if="message.partner_ids.length > message.more_recipients_value - 1"> |
|||
<span t-att-title="message.more_recipients"> |
|||
and <t t-esc="message.partner_ids.length - message.more_recipients_value"/> more |
|||
</span> |
|||
</t> |
|||
</span> |
|||
</t> |
|||
</t> |
|||
</template> |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0"?> |
|||
<openerp> |
|||
<data> |
|||
<template id="mail_to_assets_backend" |
|||
name="mail_to_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
<xpath expr="." position="inside"> |
|||
<link rel="stylesheet" href="/mail_to/static/src/css/mail_to.css"/> |
|||
<script src="/mail_to/static/src/js/mail_to.js" type="text/javascript"></script> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,16 @@ |
|||
Smart buttons for mails count |
|||
============================= |
|||
|
|||
This module adds Smart buttons with "Mails from" and "Mails to" count of mails in the partner form. |
|||
|
|||
Usage |
|||
----- |
|||
|
|||
You can see Smart buttons "Mails from" and "Mails to" in the contact form in the Messaging/Contacts menu. If you click on these buttons, you can see list of corresponded mails. Click on the "Send a message" link to send mail to the partner. |
|||
|
|||
Further information |
|||
------------------- |
|||
|
|||
HTML Description: https://apps.odoo.com/apps/modules/9.0/res_partner_mails_count/ |
|||
|
|||
Tested on Odoo 9.0 b9f206953e3f877adf18643f154d1262842564ee |
@ -0,0 +1,2 @@ |
|||
# -*- coding: utf-8 -*- |
|||
import models |
@ -0,0 +1,28 @@ |
|||
# -*- coding: utf-8 -*- |
|||
{ |
|||
"name": """Partner mails count""", |
|||
"summary": """Displays amount of incoming and outgoing partner mails.""", |
|||
"category": "Sales Management", |
|||
"images": ['images/1.png'], |
|||
"version": "1.0.0", |
|||
|
|||
"author": "IT-Projects LLC, Pavel Romanchenko", |
|||
"website": "https://it-projects.info", |
|||
"license": "LGPL-3", |
|||
"price": 30.00, |
|||
"currency": "EUR", |
|||
|
|||
"depends": [ |
|||
'mail_all', |
|||
'web_tour_extra', |
|||
], |
|||
"external_dependencies": {"python": [], "bin": []}, |
|||
"data": [ |
|||
'views/res_partner_mails_count.xml', |
|||
'templates.xml', |
|||
], |
|||
"demo": [ |
|||
], |
|||
"installable": True, |
|||
"auto_install": False, |
|||
} |
After Width: 1128 | Height: 528 | Size: 92 KiB |
@ -0,0 +1,19 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from openerp import models, fields, api |
|||
|
|||
|
|||
class res_partner(models.Model): |
|||
_inherit = 'res.partner' |
|||
mails_to = fields.Integer(compute="_mails_to") |
|||
mails_from = fields.Integer(compute="_mails_from") |
|||
|
|||
@api.one |
|||
def _mails_to(self): |
|||
for r in self: |
|||
r.mails_to = self.env['mail.message'].sudo().search_count([('partner_ids', 'in', r.id)]) |
|||
|
|||
@api.one |
|||
def _mails_from(self): |
|||
for r in self: |
|||
r.mails_from = self.env['mail.message'].sudo().search_count([('author_id', '=', r.id)]) |
After Width: 1128 | Height: 528 | Size: 66 KiB |
After Width: 1128 | Height: 528 | Size: 63 KiB |
After Width: 1128 | Height: 528 | Size: 46 KiB |
After Width: 100 | Height: 100 | Size: 2.1 KiB |
@ -0,0 +1,34 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<h2 class="oe_slogan">Smart buttons for mails count</h2> |
|||
<h3 class="oe_slogan">Display amount of messages from/to customer</h3> |
|||
<p> |
|||
Open partner (customer) form and look up how many messages he got and sent: |
|||
<img class="oe_picture oe_screenshot" src="1.png"/> |
|||
</p> |
|||
<p> |
|||
If you click any of this buttons: |
|||
<img class="oe_picture oe_screenshot" src="2.png"/> |
|||
</p> |
|||
<p> |
|||
You will see those mails: |
|||
<img class="oe_picture oe_screenshot" src="3.png"/> |
|||
</p> |
|||
</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> |
@ -0,0 +1,36 @@ |
|||
odoo.define('res_partner_mails_count.res_partner_mails_count_tour', function (require) { |
|||
'use strict'; |
|||
var Core = require('web.core'); |
|||
var Tour = require('web.Tour'); |
|||
var _t = Core._t; |
|||
|
|||
Tour.register({ |
|||
id: 'mails_count_tour', |
|||
name: _t("Mails count Tour"), |
|||
mode: 'test', |
|||
path: '/web?res_partner_mails_count=tutorial#id=3&view_type=form&model=res.partner', |
|||
steps: [ |
|||
{ |
|||
title: _t("Mails count tutorial"), |
|||
content: _t("Let's see how mails count work."), |
|||
popover: { next: _t("Start Tutorial"), end: _t("Skip") }, |
|||
}, |
|||
{ |
|||
title: _t("New fields"), |
|||
content: _t("Here is new fields with mails counters. Press one of it."), |
|||
element: '.mails_to', |
|||
waitFor: '.mails_to:visible', |
|||
}, |
|||
{ |
|||
title: _t("Done"), |
|||
placement: 'top', |
|||
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")}, |
|||
}, |
|||
] |
|||
}); |
|||
|
|||
}); |
@ -0,0 +1,47 @@ |
|||
<?xml version="1.0"?> |
|||
<openerp> |
|||
<data> |
|||
<template id="res_partner_mails_count_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
<xpath expr="." position="inside"> |
|||
<script src="/res_partner_mails_count/static/src/js/res_partner_mails_count_tour.js" |
|||
type="text/javascript"></script> |
|||
</xpath> |
|||
</template> |
|||
<record id="view_res_partner_mails_count_info_form" model="ir.ui.view"> |
|||
<field name="name">res.partner.mails.count</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base.view_partner_form"/> |
|||
<field name="priority" eval="50"/> |
|||
<field name="arch" type="xml"> |
|||
<div name="button_box" position="inside"> |
|||
<button class="oe_stat_button mails_to" type="action" |
|||
name="%(action_mails)d" |
|||
context="{'search_default_partner_ids': [active_id], 'default_model': 'res.partner', 'default_res_id': active_id}" |
|||
icon="fa-envelope"> |
|||
<field string="Mails to" name="mails_to" widget="statinfo"/> |
|||
</button> |
|||
<button class="oe_stat_button mails_from" type="action" |
|||
name="%(action_mails)d" |
|||
context="{'search_default_author_id': active_id, 'default_model': 'res.partner', 'default_res_id': active_id}" |
|||
icon="fa-envelope-o"> |
|||
<field string="Mails from" name="mails_from" widget="statinfo"/> |
|||
</button> |
|||
</div> |
|||
</field> |
|||
</record> |
|||
<record id="res_partner_mails_count_tutorial" model="ir.actions.act_url"> |
|||
<field name="name">res_partner_mails_count Tutorial</field> |
|||
<field name="url" eval="'/web?res_partner_mails_count=tutorial#id='+str(ref('base.partner_root'))+'&view_type=form&model=res.partner&/#tutorial_extra.mails_count_tour=true'"/> |
|||
<field name="target">self</field> |
|||
</record> |
|||
</data> |
|||
<data noupdate="1"> |
|||
<record id="base.open_menu" model="ir.actions.todo"> |
|||
<field name="action_id" ref="res_partner_mails_count_tutorial"/> |
|||
<field name="state">open</field> |
|||
<field name="sequence">500</field> |
|||
<field name="type">automatic</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import test_mail |
|||
from . import test_phantom |
@ -0,0 +1,33 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from openerp.tests.common import TransactionCase |
|||
|
|||
|
|||
class test_message_count(TransactionCase): |
|||
post_install = True |
|||
def test_count(self): |
|||
new_partner1 = self.env['res.partner'].sudo().create({'name': 'rpmc Test Partner one', 'email': 'tt@tt', 'notify_email': 'always'}) |
|||
new_partner2 = self.env['res.partner'].sudo().create({'name': 'rpmc Test Partner two', 'email': 'rr@rr', 'notify_email': 'always'}) |
|||
self.assertEqual(new_partner1.mails_to, 0, 'rpmc: new partner have mails_to != 0') |
|||
mail_compose = self.env['mail.compose.message'] |
|||
compose = mail_compose.with_context( |
|||
{ |
|||
'default_composition_mode': 'comment', |
|||
}).create( |
|||
{ |
|||
'subject': 'test subj', |
|||
'body': 'test body', |
|||
'partner_ids': [(4, new_partner2.id)], |
|||
'email_from': 'tt@tt', |
|||
'author_id': new_partner1.id |
|||
}) |
|||
compose.send_mail() |
|||
self.assertEqual(new_partner1.mails_to, 0) |
|||
self.assertEqual(new_partner1.mails_from, 1, 'rpmc: one message but mails_from != 1') |
|||
self.assertEqual(new_partner2.mails_to, 1, 'rpmc: one message but mails_to != 1') |
|||
self.assertEqual(new_partner2.mails_from, 0) |
|||
compose.send_mail() |
|||
self.assertEqual(new_partner1.mails_to, 0) |
|||
self.assertEqual(new_partner1.mails_from, 2, 'rpmc: one message but mails_from != 2') |
|||
self.assertEqual(new_partner2.mails_to, 2, 'rpmc: one message but mails_to != 2') |
|||
self.assertEqual(new_partner2.mails_from, 0) |
@ -0,0 +1,19 @@ |
|||
import openerp.tests |
|||
|
|||
@openerp.tests.common.at_install(False) |
|||
@openerp.tests.common.post_install(True) |
|||
class TestUi(openerp.tests.HttpCase): |
|||
def test_01_res_partner_mails_to_count(self): |
|||
# self.phantom_js('/', "openerp.Tour.run('mails_count_tour', 'test')", "openerp.Tour.tours.mails_count_tour", login="admin") |
|||
self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('mails_count_tour', 'test')","odoo.__DEBUG__.services['web.Tour'].tours.mails_count_tour", login="admin") |
|||
|
|||
def test_02_res_partner_mails_from_count(self): |
|||
# wait till page loaded and then click and wait again |
|||
code = """ |
|||
setTimeout(function () { |
|||
$(".mails_from").click(); |
|||
setTimeout(function () {console.log('ok');}, 3000); |
|||
}, 3000); |
|||
""" |
|||
link = '/web#id=3&view_type=form&model=res.partner' |
|||
self.phantom_js(link, code, "odoo.__DEBUG__.services['web.Tour'].tours.mails_count_tour", login="admin") |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<openerp> |
|||
<data> |
|||
<record id="action_mails" model="ir.actions.client"> |
|||
<field name="name">Mails</field> |
|||
<field name="tag">mail.chat.instant_messaging</field> |
|||
<field name="res_model">mail.message</field> |
|||
<field name="context">{ |
|||
'active_id': 'channel_all' |
|||
}</field> |
|||
<field name="help" type="html"> |
|||
<p> |
|||
Mails not found. Probably, they exist, but you don't have access. |
|||
</p> |
|||
</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |