Browse Source

Merge branch '8.0' of /home/iii/addons-yelizariev/../mail_todo_custom into 8.0

pull/1/head
Ildar Nasyrov 9 years ago
parent
commit
ef2a32caad
  1. 2
      mail_todo_custom/README.rst
  2. 0
      mail_todo_custom/__init__.py
  3. 13
      mail_todo_custom/__openerp__.py
  4. 25
      mail_todo_custom/mail_todo_custom.xml
  5. 44
      mail_todo_custom/static/src/js/mail_todo_custom.js

2
mail_todo_custom/README.rst

@ -0,0 +1,2 @@
Mark unstarred email as read, remove filter in 'To-do' folder
=============================================================

0
mail_todo_custom/__init__.py

13
mail_todo_custom/__openerp__.py

@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
{
'name': "Mark unstarred email as read, remove filter in 'To-do' folder",
'version': '1.0',
'author': 'IT-Projects LLC',
'license': 'GPL-3',
'website': "https://yelizariev.github.io",
'category': 'Tools',
'depends': ['mail'],
'data': ['mail_todo_custom.xml'],
'demo': [],
'installable': True,
}

25
mail_todo_custom/mail_todo_custom.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend_inherited_mail_todo_custom" name="Mail todo custom" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/mail_todo_custom/static/src/js/mail_todo_custom.js"></script>
</xpath>
</template>
<record id="mail.action_mail_star_feeds" model="ir.actions.client">
<field name="context">
{
'default_model': 'res.users',
'default_res_id': uid,
'thread_model': 'res.partner',
'search_default_message_unread': False,
'view_todo': True
}
</field>
</record>
</data>
</openerp>

44
mail_todo_custom/static/src/js/mail_todo_custom.js

@ -0,0 +1,44 @@
openerp.mail_todo_custom = function(session) {
var mail = session.mail;
mail.ThreadMessage.include({
on_star: function (event) {
event.stopPropagation();
var self=this;
var button = self.$('.oe_star:first');
this.ds_message.call('set_message_starred', [[self.id], !self.is_favorite, true])
.then(function (star) {
self.is_favorite=star;
if (self.is_favorite) {
button.addClass('oe_starred');
} else {
button.removeClass('oe_starred');
}
if (self.options.view_inbox && self.is_favorite) {
self.on_message_read_unread(true);
}
else {
self.check_for_rerender();
}
if (self.options.view_todo && !self.is_favorite) {
self.on_message_read_unread(true);
}
});
return false;
},
});
mail.Widget.include({
init: function (parent, action) {
this._super(parent, action);
this.action.params.view_todo = this.action.context.view_todo || false;
},
});
}
Loading…
Cancel
Save