[ADD] Added first not-working draft for widget. Cleaned message search function.
bzr revid: tde@openerp.com-20120202141843-4jq49mbd7a6ecq4b
This commit is contained in:
parent
109647a109
commit
1b9b26693c
|
@ -68,7 +68,19 @@ The main features are:
|
||||||
'installable': True,
|
'installable': True,
|
||||||
'auto_install': False,
|
'auto_install': False,
|
||||||
'certificate': '001056784984222247309',
|
'certificate': '001056784984222247309',
|
||||||
'images': ['images/customer_history.jpeg','images/messages_form.jpeg','images/messages_list.jpeg'],
|
'images': [
|
||||||
'css': ['static/src/css/mail_group.css'],
|
'images/customer_history.jpeg',
|
||||||
|
'images/messages_form.jpeg',
|
||||||
|
'images/messages_list.jpeg',
|
||||||
|
],
|
||||||
|
'css': [
|
||||||
|
'static/src/css/mail_group.css',
|
||||||
|
],
|
||||||
|
'js': [
|
||||||
|
'static/src/js/mail.js',
|
||||||
|
],
|
||||||
|
'qweb': [
|
||||||
|
'static/src/xml/mail.xml',
|
||||||
|
],
|
||||||
}
|
}
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -205,70 +205,81 @@ class mail_message(osv.osv):
|
||||||
notification_obj.create(cr, uid, {'user_id': sub.user_id, 'message_id': msg_id}, context=context)
|
notification_obj.create(cr, uid, {'user_id': sub.user_id, 'message_id': msg_id}, context=context)
|
||||||
return msg_id
|
return msg_id
|
||||||
|
|
||||||
|
def get_pushed_messages(self, cr, uid, context=None):
|
||||||
|
"""Wall: get messages to display"""
|
||||||
|
notification_obj = self.pool.get('mail.notification')
|
||||||
|
notification_ids = notification_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
|
||||||
|
notifications = notification_obj.browse(cr, uid, notification_ids, context=context)
|
||||||
|
|
||||||
|
# TODO / REMARK: classify based on res_model / res_id to have a 1_level hierarchy ?
|
||||||
|
|
||||||
|
return notifications
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------
|
#------------------------------------------------------
|
||||||
# Note specific api
|
# Note specific api
|
||||||
#------------------------------------------------------
|
#------------------------------------------------------
|
||||||
|
|
||||||
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
|
#def tmp_backup(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
|
||||||
if not context or not context.has_key('filter_search'):
|
#if not context or not context.has_key('filter_search'):
|
||||||
return super(mail_message, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
|
#return super(mail_message, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
|
||||||
|
|
||||||
# get subscriptions
|
## get subscriptions
|
||||||
sub_obj = self.pool.get('mail.subscription')
|
#sub_obj = self.pool.get('mail.subscription')
|
||||||
sub_ids = sub_obj.search(cr, uid, [('user_id', '=', uid)])
|
#sub_ids = sub_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||||
subs = sub_obj.browse(cr, uid, sub_ids)
|
#subs = sub_obj.browse(cr, uid, sub_ids)
|
||||||
|
|
||||||
# stock tweets to find
|
## stock tweets to find
|
||||||
res_model_ids_dict = {}
|
#res_model_ids_dict = {}
|
||||||
res_model_all_list = []
|
#res_model_all_list = []
|
||||||
|
|
||||||
# check all subscriptions
|
## check all subscriptions
|
||||||
for sub in subs:
|
#for sub in subs:
|
||||||
if sub.res_model and sub.res_id == 0 and sub.res_domain == False:
|
#if sub.res_model and sub.res_id == 0 and sub.res_domain == False:
|
||||||
print "s-1"
|
#print "s-1"
|
||||||
if sub.res_model not in res_model_all_list:
|
#if sub.res_model not in res_model_all_list:
|
||||||
res_model_all_list.append(sub.res_model)
|
#res_model_all_list.append(sub.res_model)
|
||||||
elif sub.res_model and sub.res_id:
|
#elif sub.res_model and sub.res_id:
|
||||||
print "s-2"
|
#print "s-2"
|
||||||
if res_model_ids_dict.has_key(sub.res_model):
|
#if res_model_ids_dict.has_key(sub.res_model):
|
||||||
res_model_ids_dict[sub.res_model].append(sub.res_id)
|
#res_model_ids_dict[sub.res_model].append(sub.res_id)
|
||||||
else:
|
#else:
|
||||||
res_model_ids_dict[sub.res_model] = [sub.res_id]
|
#res_model_ids_dict[sub.res_model] = [sub.res_id]
|
||||||
elif sub.res_model and sub.res_domain:
|
#elif sub.res_model and sub.res_domain:
|
||||||
print "s-3"
|
#print "s-3"
|
||||||
res_obj = self.pool.get(sub.res_model)
|
#res_obj = self.pool.get(sub.res_model)
|
||||||
print sub.res_domain
|
#print sub.res_domain
|
||||||
#res_ids = res_obj.search(cr, uid, [('id', 'in', [1,2])])
|
##res_ids = res_obj.search(cr, uid, [('id', 'in', [1,2])])
|
||||||
res_ids = res_obj.search(cr, uid, eval(sub.res_domain))
|
#res_ids = res_obj.search(cr, uid, eval(sub.res_domain))
|
||||||
if res_model_ids_dict.has_key(sub.res_model):
|
#if res_model_ids_dict.has_key(sub.res_model):
|
||||||
res_model_ids_dict[sub.res_model] += res_ids
|
#res_model_ids_dict[sub.res_model] += res_ids
|
||||||
else:
|
#else:
|
||||||
res_model_ids_dict[sub.res_model] = res_ids
|
#res_model_ids_dict[sub.res_model] = res_ids
|
||||||
print 'cacaprout'
|
#print 'cacaprout'
|
||||||
else:
|
#else:
|
||||||
print 'erreur !!!'
|
#print 'erreur !!!'
|
||||||
print sub
|
#print sub
|
||||||
|
|
||||||
# add fully-followed domains
|
## add fully-followed domains
|
||||||
args.append('|')
|
#args.append('|')
|
||||||
args.append(['model', 'in', res_model_all_list])
|
#args.append(['model', 'in', res_model_all_list])
|
||||||
|
|
||||||
# add partially-followed domains
|
## add partially-followed domains
|
||||||
for x in range(0, len(res_model_ids_dict.keys())-1):
|
#for x in range(0, len(res_model_ids_dict.keys())-1):
|
||||||
args.append('|')
|
#args.append('|')
|
||||||
|
|
||||||
for res_model in res_model_ids_dict.keys():
|
#for res_model in res_model_ids_dict.keys():
|
||||||
if res_model not in res_model_all_list:
|
#if res_model not in res_model_all_list:
|
||||||
args.append('&')
|
#args.append('&')
|
||||||
args.append(['model', '=', res_model])
|
#args.append(['model', '=', res_model])
|
||||||
args.append(['res_id', 'in', res_model_ids_dict[res_model]])
|
#args.append(['res_id', 'in', res_model_ids_dict[res_model]])
|
||||||
|
|
||||||
if context and context.has_key('filter_search'):
|
#if context and context.has_key('filter_search'):
|
||||||
pass
|
#pass
|
||||||
else:
|
#else:
|
||||||
args = []
|
#args = []
|
||||||
print args
|
#print args
|
||||||
return super(mail_message, self).search(cr, uid, args, offset=offset, limit=limit,order=order, context=context, count=count)
|
#return super(mail_message, self).search(cr, uid, args, offset=offset, limit=limit,order=order, context=context, count=count)
|
||||||
|
|
||||||
#------------------------------------------------------
|
#------------------------------------------------------
|
||||||
# E-Mail api
|
# E-Mail api
|
||||||
|
|
|
@ -1,25 +1,34 @@
|
||||||
openerp.mail = function(session) {
|
openerp.mail = function(session) {
|
||||||
|
|
||||||
var mail = session.mail = {};
|
var mail = session.mail = {};
|
||||||
|
|
||||||
mail.Wall = session.web.Widget.extend({
|
mail.Wall = session.web.Widget.extend({
|
||||||
init: function(parent) {
|
init: function(parent) {
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
this.$element
|
// this.$element
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
session.ThreadView
|
mail.ThreadView = session.web.Widget.extend({
|
||||||
|
template: 'MailTest',
|
||||||
session.MessgageInput
|
|
||||||
|
init: function(parent) {
|
||||||
|
},
|
||||||
|
|
||||||
var w = new session.mail.ThreadView(this);
|
start: function() {
|
||||||
|
// this.$element
|
||||||
w.appendTo($("div.wall"));
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
mail.MessgageInput = session.web.Widget.extend({
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var tv = new mail.ThreadView(this);
|
||||||
|
// tv.appendTo($("div.wall"));
|
||||||
|
// tv.appendTo($("body"));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
|
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<template>
|
||||||
|
|
||||||
|
<t t-name="MailTest">
|
||||||
|
<div style="height:100%;">
|
||||||
|
<p>Hello world !</p>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<!-- <t t-extend="ViewManagerAction">
|
||||||
|
<t t-jquery=".oe-shortcut-toggle" t-operation="after">
|
||||||
|
<a class="oe-share_link" href="#share_link" title="Follow">Follow</a>
|
||||||
|
<a class="oe-share" href="#share" title="Unfollow">Unfollow</a>
|
||||||
|
</t>
|
||||||
|
</t>-->
|
||||||
|
|
||||||
|
</template>
|
Loading…
Reference in New Issue