diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index ee3f96a53dd..a6fd8da472c 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2105,6 +2105,9 @@ .openerp .oe_form_invisible { 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 { display: none !important; } @@ -2401,6 +2404,7 @@ background: white; min-width: 60px; 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] { background: #e5e5e5 !important; @@ -2415,6 +2419,7 @@ -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; + color: #4c4c4c; } .openerp .oe_form textarea.oe_inline[disabled] { border-left: 8px solid #eeeeee; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 37de16e5c9b..b79580d8225 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -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)) .oe_form_invisible display: none !important + .oe_form_editable + .oe_read_only + display: none !important .oe_form_readonly .oe_edit_only, .oe_form_field:empty display: none !important @@ -1901,6 +1904,7 @@ $sheet-padding: 16px background: white min-width: 60px color: #1f1f1f + font-family: "Lucida Grande", Helvetica, Verdana, Arial, sans-serif input[readonly], select[readonly], textarea[readonly], input[disabled], select[disabled] background: #E5E5E5 !important color: #666 @@ -1909,6 +1913,7 @@ $sheet-padding: 16px padding-left: 8px @include box-shadow(none) @include radius(0px) + color: #4c4c4c textarea.oe_inline[disabled] border-left: 8px solid #eee .oe_form_field_url button img diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 5df048d8b7a..1143bdfc2af 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1364,7 +1364,7 @@ instance.web.View = instance.web.Widget.extend({ } else if (action_data.type=="action") { return this.rpc('/web/action/load', { 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 }).then(handler); } else { @@ -1452,7 +1452,7 @@ instance.web.View = instance.web.Widget.extend({ is_action_enabled: function(action) { var attrs = this.fields_view.arch.attrs; return (action in attrs) ? JSON.parse(attrs[action]) : true; - } + }, }); /** diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index a8ed25694ba..7feb371754c 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -3,6 +3,27 @@ background: white; 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 { background: url(/web/static/src/img/form_sheetbg.png); width: 100%; @@ -178,6 +199,7 @@ } .openerp .oe_kanban_view .oe_kanban_add { top: -8px; + z-index: 2; } .openerp .oe_kanban_view .oe_kanban_header .oe_dropdown_toggle { top: -2px; @@ -197,6 +219,9 @@ width: 185px; padding: 10px; } +.openerp .oe_kanban_view .oe_kanban_quick_create { + z-index: 2; +} .openerp .oe_kanban_view .oe_kanban_quick_create input { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; @@ -266,6 +291,18 @@ font-weight: bold; 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 { margin-bottom: 4px; } diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass index 2182fb693ea..2752cecd294 100644 --- a/addons/web_kanban/static/src/css/kanban.sass +++ b/addons/web_kanban/static/src/css/kanban.sass @@ -51,9 +51,28 @@ //background: url(data:image/pngbase64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAKElEQVQIHWP8DwTv379nAAFBQUEGhnfv3oHEwADEZgJLIRGMIClkLQCr3x2Htp/lLwAAAABJRU5ErkJggg==) background: white height: inherit - &.oe_kanban_grouped .oe_kanban_dummy_cell - background: url(/web/static/src/img/form_sheetbg.png) - width: 100% + .oe_view_nocontent + position: relative + 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 text-align: center display: none @@ -195,6 +214,7 @@ position: relative .oe_kanban_add top: -8px + z-index: 2 .oe_kanban_header .oe_dropdown_toggle top: -2px height: 14px @@ -209,6 +229,8 @@ .oe_kanban_no_group .oe_kanban_quick_create width: 185px padding: 10px + .oe_kanban_quick_create + z-index: 2 .oe_kanban_quick_create input @include box-sizing(border-box) outline: none @@ -258,6 +280,16 @@ .oe_kanban_title font-weight: bold 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_record margin-bottom: 4px diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 651fcbc4019..b02f8d12151 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -225,7 +225,6 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ }, do_search: function(domain, context, group_by) { var self = this; - this.$el.find('.oe_view_nocontent').remove(); this.search_domain = domain; this.search_context = context; 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 = new instance.web.Model(self.dataset.model, context, domain).query().group_by(grouping_fields); return self.alive($.when(grouping)).done(function(groups) { + self.remove_no_result(); if (groups) { self.do_process_groups(groups); } else { @@ -248,6 +248,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ }, do_process_groups: function(groups) { var self = this; + this.$el.find('table:first').show(); this.$el.removeClass('oe_kanban_ungrouped').addClass('oe_kanban_grouped'); this.add_group_mutex.exec(function() { self.do_clear_groups(); @@ -256,13 +257,15 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ self.no_result(); return false; } + self.nb_records = 0; var remaining = groups.length - 1, groups_array = []; return $.when.apply(null, _.map(groups, function (group, index) { var dataset = new instance.web.DataSetSearch(self, self.dataset.model, 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 }) - .then(function(records) { + .then(function (records) { + self.nb_records += records.length; self.dataset.ids.push.apply(self.dataset.ids, dataset.ids); groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset); if (!remaining--) { @@ -270,11 +273,16 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ return self.do_add_groups(groups_array); } }); - })); + })).then(function () { + if(!self.nb_records) { + self.no_result(); + } + }); }); }, do_process_dataset: function() { var self = this; + this.$el.find('table:first').show(); this.$el.removeClass('oe_kanban_grouped').addClass('oe_kanban_ungrouped'); this.add_group_mutex.exec(function() { 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 groups_started = _.map(this.groups, function(group) { if (!group.is_started) { + group.on("add_record", self, function () { + self.remove_no_result(); + }); return group.insertBefore($last_td); } }); @@ -445,20 +456,22 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ } }, no_result: function() { + var self = this; if (this.groups.group_by || !this.options.action - || !this.options.action.help) { + || (!this.options.action.help && !this.options.action.get_empty_list_help)) { return; } - this.$el.find('.oe_view_nocontent').remove(); - this.$el.prepend( - $('
').html(this.options.action.help) - ); - var create_nocontent = this.$buttons; + this.$el.find('table:first').css("position", "absolute"); + $(QWeb.render('KanbanView.nocontent', { content : this.options.action.get_empty_list_help || this.options.action.help})).insertAfter(this.$('table:first')); 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 @@ -573,19 +586,26 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({ }); this.$el.find('.oe_kanban_add').click(function () { - if (self.quick) { - return self.quick.trigger('close'); + if (self.view.quick) { + self.view.quick.trigger('close'); } + if (self.quick) { + return false; + } + self.view.$el.find('.oe_view_nocontent').hide(); var ctx = {}; ctx['default_' + self.view.group_by] = self.value; self.quick = new (get_class(self.view.quick_create_class))(this, self.dataset, ctx, true) .on('added', self, self.proxy('quick_created')) .on('close', self, function() { + self.view.$el.find('.oe_view_nocontent').show(); this.quick.destroy(); + delete self.view.quick; delete this.quick; }); self.quick.appendTo($(".oe_kanban_group_list_header", self.$records)); 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. 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) { var id = record, self = this; + self.view.remove_no_result(); + self.trigger("add_record"); this.dataset.read_ids([id], this.view.fields_keys) .done(function (records) { self.view.dataset.ids.push(id); diff --git a/addons/web_kanban/static/src/xml/web_kanban.xml b/addons/web_kanban/static/src/xml/web_kanban.xml index f943541d007..23da223e615 100644 --- a/addons/web_kanban/static/src/xml/web_kanban.xml +++ b/addons/web_kanban/static/src/xml/web_kanban.xml @@ -100,4 +100,12 @@
+ +
+
+
+ +
+
+