Browse Source

[REF] Apply remarks

pull/1/head
ufaks 9 years ago
commit
83b2e473f9
  1. 2
      README.rst
  2. 0
      __init__.py
  3. 12
      __openerp__.py
  4. 25
      mail_todo_custom.xml
  5. 44
      static/src/js/mail_todo_custom.js

2
README.rst

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

0
__init__.py

12
__openerp__.py

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

25
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
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