Browse Source

[ADD] Create module Mail Sent and added changes that displayed Sent menu item

pull/6/head
x620 9 years ago
parent
commit
ad9462c0f5
  1. 15
      mail_sent/README.rst
  2. 3
      mail_sent/__init__.py
  3. 26
      mail_sent/__openerp__.py
  4. 1
      mail_sent/models/__init__.py
  5. BIN
      mail_sent/static/description/icon.png
  6. 56
      mail_sent/static/src/js/sent.js
  7. 20
      mail_sent/static/src/xml/menu.xml
  8. 12
      mail_sent/views/templates.xml

15
mail_sent/README.rst

@ -0,0 +1,15 @@
Mail Sent
=========
Adds Sent menu, which shows sent messages
Usage
-----
Click Discuss/Sent menu -- sent messages are displayed
Further information
-------------------
HTML Description: https://apps.odoo.com/apps/modules/9.0/mail_sent/
Tested on Odoo 9.0 b9f206953e3f877adf18643f154d1262842564ee

3
mail_sent/__init__.py

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

26
mail_sent/__openerp__.py

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
{
"name": "Mail Sent",
"summary": """Create sent channel""",
"category": "Discuss",
"images": [],
"version": "1.0.0",
"author": "IT-Projects LLC, Pavel Romanchenko",
"website": "https://it-projects.info",
"license": "LGPL-3",
"depends": [
"base",
"mail",
"mail_base"
],
"data": [
"views/templates.xml",
],
"qweb": [
"static/src/xml/menu.xml",
],
'installable': True,
}

1
mail_sent/models/__init__.py

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

BIN
mail_sent/static/description/icon.png

After

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

56
mail_sent/static/src/js/sent.js

@ -0,0 +1,56 @@
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 _t = core._t;
//-------------------------------------------------------------------------------
// 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);
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") ? [] : 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: _t("Archive"),
type: "static"
});
return $.when();
});
return base_obj.chat_manager;
});

20
mail_sent/static/src/xml/menu.xml

@ -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_starred]" 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"> <i class="fa fa-send"/> 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>

12
mail_sent/views/templates.xml

@ -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>
Loading…
Cancel
Save