[MERGE] Alias Visibility and Salesteams View. Improve the display of alias in form views and in empty list help messages. Improve the use, visibility and display of salesteams.

Add support for 'no result' help message in kanban views.
Add css for empty list in kanban views + generic display of mail aliases.

bzr revid: tde@openerp.com-20130405152131-4auticfaj24wbpqx
This commit is contained in:
Thibault Delavallée 2013-04-05 17:21:31 +02:00
commit aaed0ccd43
7 changed files with 126 additions and 17 deletions

View File

@ -2105,6 +2105,9 @@
.openerp .oe_form_invisible { .openerp .oe_form_invisible {
display: none !important; display: none !important;
} }
.openerp .oe_form_editable .oe_read_only {
display: none !important;
}
.openerp .oe_form_readonly .oe_edit_only, .openerp .oe_form_readonly .oe_form_field:empty { .openerp .oe_form_readonly .oe_edit_only, .openerp .oe_form_readonly .oe_form_field:empty {
display: none !important; display: none !important;
} }
@ -2401,6 +2404,7 @@
background: white; background: white;
min-width: 60px; min-width: 60px;
color: #1f1f1f; color: #1f1f1f;
font-family: "Lucida Grande", Helvetica, Verdana, Arial, sans-serif;
} }
.openerp .oe_form input[readonly], .openerp .oe_form select[readonly], .openerp .oe_form textarea[readonly], .openerp .oe_form input[disabled], .openerp .oe_form select[disabled] { .openerp .oe_form input[readonly], .openerp .oe_form select[readonly], .openerp .oe_form textarea[readonly], .openerp .oe_form input[disabled], .openerp .oe_form select[disabled] {
background: #e5e5e5 !important; background: #e5e5e5 !important;
@ -2415,6 +2419,7 @@
-moz-border-radius: 0px; -moz-border-radius: 0px;
-webkit-border-radius: 0px; -webkit-border-radius: 0px;
border-radius: 0px; border-radius: 0px;
color: #4c4c4c;
} }
.openerp .oe_form textarea.oe_inline[disabled] { .openerp .oe_form textarea.oe_inline[disabled] {
border-left: 8px solid #eeeeee; border-left: 8px solid #eeeeee;

View File

@ -1681,6 +1681,9 @@ $sheet-padding: 16px
@include box-shadow((0 1px 2px rgba(0, 0, 0, .1), 0 1px 1px rgba(255, 255, 255, .8) inset)) @include box-shadow((0 1px 2px rgba(0, 0, 0, .1), 0 1px 1px rgba(255, 255, 255, .8) inset))
.oe_form_invisible .oe_form_invisible
display: none !important display: none !important
.oe_form_editable
.oe_read_only
display: none !important
.oe_form_readonly .oe_form_readonly
.oe_edit_only, .oe_form_field:empty .oe_edit_only, .oe_form_field:empty
display: none !important display: none !important
@ -1901,6 +1904,7 @@ $sheet-padding: 16px
background: white background: white
min-width: 60px min-width: 60px
color: #1f1f1f color: #1f1f1f
font-family: "Lucida Grande", Helvetica, Verdana, Arial, sans-serif
input[readonly], select[readonly], textarea[readonly], input[disabled], select[disabled] input[readonly], select[readonly], textarea[readonly], input[disabled], select[disabled]
background: #E5E5E5 !important background: #E5E5E5 !important
color: #666 color: #666
@ -1909,6 +1913,7 @@ $sheet-padding: 16px
padding-left: 8px padding-left: 8px
@include box-shadow(none) @include box-shadow(none)
@include radius(0px) @include radius(0px)
color: #4c4c4c
textarea.oe_inline[disabled] textarea.oe_inline[disabled]
border-left: 8px solid #eee border-left: 8px solid #eee
.oe_form_field_url button img .oe_form_field_url button img

View File

@ -1364,7 +1364,7 @@ instance.web.View = instance.web.Widget.extend({
} else if (action_data.type=="action") { } else if (action_data.type=="action") {
return this.rpc('/web/action/load', { return this.rpc('/web/action/load', {
action_id: action_data.name, action_id: action_data.name,
context: instance.web.pyeval.eval('context', context), context: _.extend({'active_model': dataset.model, 'active_ids': dataset.ids, 'active_id': record_id}, instance.web.pyeval.eval('context', context)),
do_not_eval: true do_not_eval: true
}).then(handler); }).then(handler);
} else { } else {
@ -1452,7 +1452,7 @@ instance.web.View = instance.web.Widget.extend({
is_action_enabled: function(action) { is_action_enabled: function(action) {
var attrs = this.fields_view.arch.attrs; var attrs = this.fields_view.arch.attrs;
return (action in attrs) ? JSON.parse(attrs[action]) : true; return (action in attrs) ? JSON.parse(attrs[action]) : true;
} },
}); });
/** /**

View File

@ -3,6 +3,27 @@
background: white; background: white;
height: inherit; height: inherit;
} }
.openerp .oe_kanban_view .oe_view_nocontent {
position: relative;
z-index: 1;
max-width: none;
height: 100%;
}
.openerp .oe_kanban_view .oe_view_nocontent .oe_view_nocontent_content {
margin-left: 90px;
margin-top: 5px;
max-width: 700px;
}
.openerp .oe_kanban_view .oe_view_nocontent .oe_view_nocontent_bg {
background: #eeeeee;
opacity: 0.7;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -1;
}
.openerp .oe_kanban_view.oe_kanban_grouped .oe_kanban_dummy_cell { .openerp .oe_kanban_view.oe_kanban_grouped .oe_kanban_dummy_cell {
background: url(/web/static/src/img/form_sheetbg.png); background: url(/web/static/src/img/form_sheetbg.png);
width: 100%; width: 100%;
@ -178,6 +199,7 @@
} }
.openerp .oe_kanban_view .oe_kanban_add { .openerp .oe_kanban_view .oe_kanban_add {
top: -8px; top: -8px;
z-index: 2;
} }
.openerp .oe_kanban_view .oe_kanban_header .oe_dropdown_toggle { .openerp .oe_kanban_view .oe_kanban_header .oe_dropdown_toggle {
top: -2px; top: -2px;
@ -197,6 +219,9 @@
width: 185px; width: 185px;
padding: 10px; padding: 10px;
} }
.openerp .oe_kanban_view .oe_kanban_quick_create {
z-index: 2;
}
.openerp .oe_kanban_view .oe_kanban_quick_create input { .openerp .oe_kanban_view .oe_kanban_quick_create input {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
@ -266,6 +291,18 @@
font-weight: bold; font-weight: bold;
margin: 2px 4px; margin: 2px 4px;
} }
.openerp .oe_kanban_view .oe_kanban_record .oe_kanban_alias {
margin: 0px 0 8px 0;
}
.openerp .oe_kanban_view .oe_kanban_record .oe_kanban_alias .oe_e {
font-size: 30px;
line-height: 6px;
vertical-align: top;
margin-right: 3px;
color: white;
text-shadow: 0px 0px 2px black;
float: left;
}
.openerp .oe_kanban_view.oe_kanban_grouped .oe_kanban_record { .openerp .oe_kanban_view.oe_kanban_grouped .oe_kanban_record {
margin-bottom: 4px; margin-bottom: 4px;
} }

View File

@ -51,9 +51,28 @@
//background: url(data:image/pngbase64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAKElEQVQIHWP8DwTv379nAAFBQUEGhnfv3oHEwADEZgJLIRGMIClkLQCr3x2Htp/lLwAAAABJRU5ErkJggg==) //background: url(data:image/pngbase64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAKElEQVQIHWP8DwTv379nAAFBQUEGhnfv3oHEwADEZgJLIRGMIClkLQCr3x2Htp/lLwAAAABJRU5ErkJggg==)
background: white background: white
height: inherit height: inherit
&.oe_kanban_grouped .oe_kanban_dummy_cell .oe_view_nocontent
background: url(/web/static/src/img/form_sheetbg.png) position: relative
width: 100% z-index: 1
max-width: none
height: 100%
.oe_view_nocontent_content
margin-left: 90px
margin-top: 5px
max-width: 700px
.oe_view_nocontent_bg
background: #eee
opacity: 0.7
position: absolute
top: 0
bottom: 0
left: 0
right: 0
z-index: -1
&.oe_kanban_grouped
.oe_kanban_dummy_cell
background: url(/web/static/src/img/form_sheetbg.png)
width: 100%
.oe_kanban_group_length .oe_kanban_group_length
text-align: center text-align: center
display: none display: none
@ -195,6 +214,7 @@
position: relative position: relative
.oe_kanban_add .oe_kanban_add
top: -8px top: -8px
z-index: 2
.oe_kanban_header .oe_dropdown_toggle .oe_kanban_header .oe_dropdown_toggle
top: -2px top: -2px
height: 14px height: 14px
@ -209,6 +229,8 @@
.oe_kanban_no_group .oe_kanban_quick_create .oe_kanban_no_group .oe_kanban_quick_create
width: 185px width: 185px
padding: 10px padding: 10px
.oe_kanban_quick_create
z-index: 2
.oe_kanban_quick_create input .oe_kanban_quick_create input
@include box-sizing(border-box) @include box-sizing(border-box)
outline: none outline: none
@ -258,6 +280,16 @@
.oe_kanban_title .oe_kanban_title
font-weight: bold font-weight: bold
margin: 2px 4px margin: 2px 4px
.oe_kanban_alias
margin: 0px 0 8px 0
.oe_e
font-size: 30px
line-height: 6px
vertical-align: top
margin-right: 3px
color: white
text-shadow: 0px 0px 2px rgba(0, 0, 0, 1)
float: left
&.oe_kanban_grouped &.oe_kanban_grouped
.oe_kanban_record .oe_kanban_record
margin-bottom: 4px margin-bottom: 4px

View File

@ -225,7 +225,6 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
}, },
do_search: function(domain, context, group_by) { do_search: function(domain, context, group_by) {
var self = this; var self = this;
this.$el.find('.oe_view_nocontent').remove();
this.search_domain = domain; this.search_domain = domain;
this.search_context = context; this.search_context = context;
this.search_group_by = group_by; this.search_group_by = group_by;
@ -238,6 +237,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
var grouping_fields = self.group_by ? [self.group_by].concat(_.keys(self.aggregates)) : undefined; var grouping_fields = self.group_by ? [self.group_by].concat(_.keys(self.aggregates)) : undefined;
var grouping = new instance.web.Model(self.dataset.model, context, domain).query().group_by(grouping_fields); var grouping = new instance.web.Model(self.dataset.model, context, domain).query().group_by(grouping_fields);
return self.alive($.when(grouping)).done(function(groups) { return self.alive($.when(grouping)).done(function(groups) {
self.remove_no_result();
if (groups) { if (groups) {
self.do_process_groups(groups); self.do_process_groups(groups);
} else { } else {
@ -248,6 +248,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
}, },
do_process_groups: function(groups) { do_process_groups: function(groups) {
var self = this; var self = this;
this.$el.find('table:first').show();
this.$el.removeClass('oe_kanban_ungrouped').addClass('oe_kanban_grouped'); this.$el.removeClass('oe_kanban_ungrouped').addClass('oe_kanban_grouped');
this.add_group_mutex.exec(function() { this.add_group_mutex.exec(function() {
self.do_clear_groups(); self.do_clear_groups();
@ -256,13 +257,15 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
self.no_result(); self.no_result();
return false; return false;
} }
self.nb_records = 0;
var remaining = groups.length - 1, var remaining = groups.length - 1,
groups_array = []; groups_array = [];
return $.when.apply(null, _.map(groups, function (group, index) { return $.when.apply(null, _.map(groups, function (group, index) {
var dataset = new instance.web.DataSetSearch(self, self.dataset.model, var dataset = new instance.web.DataSetSearch(self, self.dataset.model,
new instance.web.CompoundContext(self.dataset.get_context(), group.model.context()), group.model.domain()); new instance.web.CompoundContext(self.dataset.get_context(), group.model.context()), group.model.domain());
return dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit }) return dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit })
.then(function(records) { .then(function (records) {
self.nb_records += records.length;
self.dataset.ids.push.apply(self.dataset.ids, dataset.ids); self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);
groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset); groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset);
if (!remaining--) { if (!remaining--) {
@ -270,11 +273,16 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
return self.do_add_groups(groups_array); return self.do_add_groups(groups_array);
} }
}); });
})); })).then(function () {
if(!self.nb_records) {
self.no_result();
}
});
}); });
}, },
do_process_dataset: function() { do_process_dataset: function() {
var self = this; var self = this;
this.$el.find('table:first').show();
this.$el.removeClass('oe_kanban_grouped').addClass('oe_kanban_ungrouped'); this.$el.removeClass('oe_kanban_grouped').addClass('oe_kanban_ungrouped');
this.add_group_mutex.exec(function() { this.add_group_mutex.exec(function() {
var def = $.Deferred(); var def = $.Deferred();
@ -313,6 +321,9 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
var $last_td = self.$el.find('.oe_kanban_groups_headers td:last'); var $last_td = self.$el.find('.oe_kanban_groups_headers td:last');
var groups_started = _.map(this.groups, function(group) { var groups_started = _.map(this.groups, function(group) {
if (!group.is_started) { if (!group.is_started) {
group.on("add_record", self, function () {
self.remove_no_result();
});
return group.insertBefore($last_td); return group.insertBefore($last_td);
} }
}); });
@ -445,20 +456,22 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
} }
}, },
no_result: function() { no_result: function() {
var self = this;
if (this.groups.group_by if (this.groups.group_by
|| !this.options.action || !this.options.action
|| !this.options.action.help) { || (!this.options.action.help && !this.options.action.get_empty_list_help)) {
return; return;
} }
this.$el.find('.oe_view_nocontent').remove(); this.$el.find('table:first').css("position", "absolute");
this.$el.prepend( $(QWeb.render('KanbanView.nocontent', { content : this.options.action.get_empty_list_help || this.options.action.help})).insertAfter(this.$('table:first'));
$('<div class="oe_view_nocontent">').html(this.options.action.help)
);
var create_nocontent = this.$buttons;
this.$el.find('.oe_view_nocontent').click(function() { this.$el.find('.oe_view_nocontent').click(function() {
create_nocontent.openerpBounce(); self.$buttons.openerpBounce();
}); });
}, },
remove_no_result: function() {
this.$el.find('table:first').css("position", false);
this.$el.find('.oe_view_nocontent').remove();
},
/* /*
* postprocessing of fields type many2many * postprocessing of fields type many2many
@ -573,19 +586,26 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({
}); });
this.$el.find('.oe_kanban_add').click(function () { this.$el.find('.oe_kanban_add').click(function () {
if (self.quick) { if (self.view.quick) {
return self.quick.trigger('close'); self.view.quick.trigger('close');
} }
if (self.quick) {
return false;
}
self.view.$el.find('.oe_view_nocontent').hide();
var ctx = {}; var ctx = {};
ctx['default_' + self.view.group_by] = self.value; ctx['default_' + self.view.group_by] = self.value;
self.quick = new (get_class(self.view.quick_create_class))(this, self.dataset, ctx, true) self.quick = new (get_class(self.view.quick_create_class))(this, self.dataset, ctx, true)
.on('added', self, self.proxy('quick_created')) .on('added', self, self.proxy('quick_created'))
.on('close', self, function() { .on('close', self, function() {
self.view.$el.find('.oe_view_nocontent').show();
this.quick.destroy(); this.quick.destroy();
delete self.view.quick;
delete this.quick; delete this.quick;
}); });
self.quick.appendTo($(".oe_kanban_group_list_header", self.$records)); self.quick.appendTo($(".oe_kanban_group_list_header", self.$records));
self.quick.focus(); self.quick.focus();
self.view.quick = self.quick;
}); });
// Add bounce effect on image '+' of kanban header when click on empty space of kanban grouped column. // Add bounce effect on image '+' of kanban header when click on empty space of kanban grouped column.
this.$records.on('click', '.oe_kanban_show_more', this.do_show_more); this.$records.on('click', '.oe_kanban_show_more', this.do_show_more);
@ -722,6 +742,8 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({
*/ */
quick_created: function (record) { quick_created: function (record) {
var id = record, self = this; var id = record, self = this;
self.view.remove_no_result();
self.trigger("add_record");
this.dataset.read_ids([id], this.view.fields_keys) this.dataset.read_ids([id], this.view.fields_keys)
.done(function (records) { .done(function (records) {
self.view.dataset.ids.push(id); self.view.dataset.ids.push(id);

View File

@ -100,4 +100,12 @@
</div> </div>
</t> </t>
</div> </div>
<t t-name="KanbanView.nocontent">
<div class="oe_view_nocontent">
<div class="oe_view_nocontent_bg"></div>
<div class="oe_view_nocontent_content">
<t t-raw="content"/>
</div>
</div>
</t>
</template> </template>