[IMP] Wall: added parameters passing (filtering, message number to display, ..). Added My Wall (all feeds versus my feeds).

bzr revid: tde@openerp.com-20120209100447-p8csuqq85jsexrdn
This commit is contained in:
Thibault Delavallée 2012-02-09 11:04:47 +01:00
parent b42db33ae1
commit 9efc4714f2
5 changed files with 32 additions and 13 deletions

View File

@ -257,9 +257,9 @@ class hr_holidays(osv.osv):
def holidays_validate_notificate(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids):
self.message_mark_done(cr, uid, [obj.id], context=context)
self.message_append_note(cr, uid, [obj.id], 'System notification', _("The %s request '%s' has been validated.") % ('leave' if obj.type == 'remove' else 'allocation', obj.name,), type='notification', context=context)
self.message_append_note(cr, uid, [obj.id], _('System notification'), _("The %s request '%s' has been validated.") % ('leave' if obj.type == 'remove' else 'allocation', obj.name,), type='notification', context=context)
if obj.holiday_status_id.double_validation:
self.message_append_note(cr, uid, [obj.id], 'System notification', _("The %s request '%s' is waiting for second validation.") % ('leave' if obj.type == 'remove' else 'allocation', obj.name,), type='notification', context=context)
self.message_append_note(cr, uid, [obj.id], _('System notification'), _("The %s request '%s' is waiting for second validation.") % ('leave' if obj.type == 'remove' else 'allocation', obj.name,), type='notification', context=context)
def holidays_validate2(self, cr, uid, ids, context=None):
self.check_holidays(cr, uid, ids, context=context)
@ -316,7 +316,7 @@ class hr_holidays(osv.osv):
def holidays_valid2_notificate(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids):
self.message_append_note(cr, uid, [obj.id], 'System notification', _("The %s request '%s' has been double validated.") % ('leave' if obj.type == 'remove' else 'allocation', obj.name,), type='notification', context=context)
self.message_append_note(cr, uid, [obj.id], _('System notification'), _("The %s request '%s' has been double validated.") % ('leave' if obj.type == 'remove' else 'allocation', obj.name,), type='notification', context=context)
def holidays_confirm(self, cr, uid, ids, context=None):
self.check_holidays(cr, uid, ids, context=context)
@ -325,7 +325,7 @@ class hr_holidays(osv.osv):
def holidays_confirm_notificate(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids):
self.message_append_note(cr, uid, [obj.id], 'System notification', _("The %s request '%s' has been confirmed and is waiting for validation.") % ('leave' if obj.type == 'remove' else 'allocation', obj.name,), type='notification', need_action_user_id=obj.employee_id.parent_id.user_id.id)
self.message_append_note(cr, uid, [obj.id], _('System notification'), _("The %s request '%s' has been confirmed and is waiting for validation.") % ('leave' if obj.type == 'remove' else 'allocation', obj.name,), type='notification', need_action_user_id=obj.employee_id.parent_id.user_id.id)
def holidays_refuse(self, cr, uid, ids, approval, context=None):
obj_emp = self.pool.get('hr.employee')

View File

@ -216,7 +216,7 @@ class mail_message(osv.osv):
notification_obj.create(cr, uid, {'user_id': vals['need_action_user_id'], 'message_id': msg_id}, context=context)
return msg_id
def get_pushed_messages(self, cr, uid, context=None):
def get_pushed_messages(self, cr, uid, ids, filter_search=False, 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)

View File

@ -230,6 +230,13 @@
<record id="action_mail_all_feeds" model="ir.actions.client">
<field name="name">(w)All Feeds</field>
<field name="tag">mail.all_feeds</field>
<field name="params" eval="{'filter_search': False, 'thread_nbr': 10}"/>
</record>
<record id="action_mail_my_feeds" model="ir.actions.client">
<field name="name">My Feeds</field>
<field name="tag">mail.all_feeds</field>
<field name="params" eval="{'filter_search': True, 'thread_nbr': 10}"/>
</record>
</data>

View File

@ -51,26 +51,35 @@
</record>
<!-- toplevel menu -->
<menuitem id="mail_feeds_main" name="Feeds" action="action_view_groups"/>
<record id="mail_feeds_main" model="ir.ui.menu">
<field name="name">Feeds</field>
<!-- <field name="sequence" eval="20"/> -->
<field name="action" ref="action_mail_all_feeds"/>
</record>
<!-- <menuitem id="mail_feeds_main" name="Feeds" action="action_mail_all_feeds"/> -->
<!-- left-side menu: Feeds !-->
<menuitem id="mail_feeds" name="Feeds" parent="mail_feeds_main"/>
<menuitem id="mail_myfeeds" name="My feeds" parent="mail_feeds" action="action_view_mytweets"/>
<menuitem id="mail_allfeeds" name="All feeds" parent="mail_feeds" action="action_view_tweets"/>
<!-- <menuitem id="mail_wallfeeds" name="(w)All feeds" parent="mail_feeds" action="action_mail_all_feeds"/>-->
<record id="mail_myfeeds" model="ir.ui.menu">
<field name="name">My Feeds</field>
<field name="sequence" eval="10"/>
<field name="action" ref="action_mail_my_feeds"/>
<field name="parent_id" ref="mail_feeds"/>
</record>
<record id="mail_wallfeeds" model="ir.ui.menu">
<field name="name">(w)All Feeds</field>
<field name="sequence" eval="20"/>
<field name="action" ref="action_mail_all_feeds"/>
<field name="parent_id" ref="mail_feeds"/>
</record>
<!-- left-side menu: Groups !-->
<menuitem id="mail_groups" name="Groups" parent="mail_feeds_main"/>
<menuitem id="mail_allgroups" name="All groups" parent="mail_groups" action="action_view_groups"/>
<!-- left-side menu: Tmp !-->
<menuitem id="mail_debug" name="Debug/Tmp" parent="mail_feeds_main"/>
<menuitem id="mail_debug_msgs" name="Messages" parent="mail_debug" action="action_view_all_message"/>
<menuitem id="mail_debug_myfeeds" name="My feeds" parent="mail_debug" action="action_view_mytweets"/>
<menuitem id="mail_debug_allfeeds" name="All feeds" parent="mail_debug" action="action_view_tweets"/>
<menuitem id="mail_debug_groups" name="Groups" parent="mail_debug" action="action_view_groups"/>
<menuitem id="mail_debug_subs" name="Subscriptions" parent="mail_debug" action="action_view_subscriptions"/>
<menuitem id="mail_debug_notifs" name="Pushed notif" parent="mail_debug" action="action_view_notifications"/>

View File

@ -95,8 +95,9 @@ openerp.mail = function(session) {
// QWeb template to use when rendering the object
template: 'WallView',
init: function() {
this._super.apply(this, arguments);
init: function (parent, params) {
this._super(parent);
this.filter_search = params['filter_search'];
/* DataSets */
this.ds_msg = new session.web.DataSet(this, 'mail.message');
},
@ -104,8 +105,9 @@ openerp.mail = function(session) {
start: function() {
var self = this;
this._super.apply(this, arguments);
console.log(this);
self.$element.find('button.oe_mail_action_comment').bind('click', function () { self.do_comment(); });
this.ds_msg.call('get_pushed_messages', []).then(
this.ds_msg.call('get_pushed_messages', [[], self.filter_search]).then(
this.proxy('display_records'));
},
@ -114,6 +116,7 @@ openerp.mail = function(session) {
},
fetch_messages: function () {
console.log('debug--fetch_messages');
return this.ds_msg.call('get_pushed_messages', []).then(
this.proxy('display_records'));
},