[IMP] extract subtype ordering from lp:~openerp-dev/openobject-addons/trunk-visibility-hr_holidays-darshan.
bzr revid: dka@tinyerp.com-20140219105246-qmm78w81erhfvhlc
This commit is contained in:
parent
bb08d9aa3a
commit
1f71463cfc
|
@ -50,7 +50,9 @@ class mail_message_subtype(osv.osv):
|
|||
help="Model the subtype applies to. If False, this subtype applies to all models."),
|
||||
'default': fields.boolean('Default',
|
||||
help="Activated by default when subscribing."),
|
||||
'sequence': fields.integer('Sequence'),
|
||||
}
|
||||
_order = 'sequence'
|
||||
_defaults = {
|
||||
'default': True,
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from collections import OrderedDict
|
||||
import base64
|
||||
import datetime
|
||||
import dateutil
|
||||
|
@ -186,7 +187,7 @@ class mail_thread(osv.AbstractModel):
|
|||
# find current model subtypes, add them to a dictionary
|
||||
subtype_obj = self.pool.get('mail.message.subtype')
|
||||
subtype_ids = subtype_obj.search(cr, uid, ['|', ('res_model', '=', self._name), ('res_model', '=', False)], context=context)
|
||||
subtype_dict = dict((subtype.name, dict(default=subtype.default, followed=False, id=subtype.id)) for subtype in subtype_obj.browse(cr, uid, subtype_ids, context=context))
|
||||
subtype_dict = OrderedDict((subtype.name, OrderedDict(default=subtype.default, followed=False, parent_model=subtype.parent_id.res_model, id=subtype.id)) for subtype in subtype_obj.browse(cr, uid, subtype_ids, context=context))
|
||||
for id in ids:
|
||||
res[id]['message_subtype_data'] = subtype_dict.copy()
|
||||
|
||||
|
|
|
@ -757,4 +757,8 @@
|
|||
.openerp .oe_sidebar_suggestion .oe_suggest_items:hover a.oe_suggestion_remove_item {
|
||||
visibility: visible;
|
||||
}
|
||||
.subtype-border {
|
||||
border-bottom: 1px solid #dddddd;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
|
|
|
@ -267,7 +267,15 @@ openerp_mail_followers = function(session, mail) {
|
|||
var records = data[id].message_subtype_data;
|
||||
this.records_length = $.map(records, function(value, index) { return index; }).length;
|
||||
if (this.records_length > 1) { self.display_followers(); }
|
||||
var old_model = '';
|
||||
_(records).each(function (record, record_name) {
|
||||
if (old_model != record.parent_model){
|
||||
if (old_model != ''){
|
||||
var index = $($list).find('.oe_subtype').length;
|
||||
$($($list).find('.oe_subtype')[index-1]).addClass('subtype-border');
|
||||
}
|
||||
old_model = record.parent_model;
|
||||
}
|
||||
record.name = record_name;
|
||||
record.followed = record.followed || undefined;
|
||||
$(session.web.qweb.render('mail.followers.subtype', {'record': record})).appendTo($list);
|
||||
|
|
Loading…
Reference in New Issue