Browse Source

[ADD] create module mail_all

pull/20/head
x620 9 years ago
parent
commit
4f3cb5ce92
  1. 20
      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. 1
      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. 56
      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

20
mail_all/README.rst

@ -0,0 +1,20 @@
===================
Show all messages
===================
Adds All menu, which shows all messages
Usage
-----
Click Discuss/All menu -- all messages are displayed
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": """Adds menu to find all 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"
],
"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 menu and click All menu on the sidebar
* You see all messages

1
mail_all/models/__init__.py

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

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">Look up all mails</h2>
<h3 class="oe_slogan">Browse all mails like</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>

56
mail_all/static/src/js/mail_all.js

@ -0,0 +1,56 @@
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;
//-------------------------------------------------------------------------------
// 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>
Loading…
Cancel
Save