diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index eab6d8f2a01..a1dfc1ec0b3 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -536,6 +536,11 @@ .openerp .oe_tags.oe_inline { min-width: 250px; } +.openerp .oe_form header .oe_tags { + margin:5px 0 0 5px; + width:400px; + padding-bottom:0; +} .openerp .oe_tags .text-wrap { width: 100% !important; } @@ -1919,7 +1924,7 @@ } .openerp .oe_form_nosheet > header { margin: -16px -16px 0 -16px; - padding: 8px; + padding: 0; } .openerp .oe_form_sheetbg { padding: 8px 0; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index f0786a35623..8364f19646b 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -475,6 +475,12 @@ $sheet-max-width: 860px text-decoration: none margin-bottom: 1px // }}} + .oe_form + header + .oe_tags + margin:5px 0 0 5px + width:400px + padding-bottom:0 // Tooltips {{{ &.oe_tooltip font-size: 12px @@ -1525,7 +1531,7 @@ $sheet-max-width: 860px margin: 16px > header margin: -16px -16px 0 -16px - padding: 8px + padding: 0 .oe_form_sheetbg padding: 8px 0 .oe_form_sheet_width diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index cf6d319326c..bd36dcbf4ba 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -130,7 +130,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ case 'field': if(this.fields_view.fields[ node.attrs['name'] ].type == 'many2many'){ node.tag = 'div'; - node.attrs['class'] = 'oe_kanban_many2many_tags'; + node.attrs['class'] = 'oe_form_field oe_tags'; node.attrs['model'] = this.fields_view.fields[node.attrs['name']].relation; node.attrs['t-att-data'] = 'record.' + node.attrs['name'] + '.raw_value'; }else { @@ -176,37 +176,6 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ } } }, - /* widget for list of tags/categories... - */ - transform_widget_many2many: function(){ - var self=this, - arg={}; - // select all widget - self.$el.find(".oe_kanban_many2many_tags").each(function(){ - var model = $(this).attr("model"); - var data = $(this).attr("data"); - var list = data.split(","); - //select all id (per model) - if(!arg[model]) arg[model]=[]; - for(var t=0;t0){ - var dataset = new instance.web.DataSetSearch(self, model, self.session.context); - dataset.name_get(_.uniq( arg[model] )).then( - function(result) { - for(var t=0;t'+result[t][1]+''); - } - } - ); - } - } - }, do_add_record: function() { this.dataset.index = null; this.do_switch_view('form'); @@ -394,7 +363,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ } else { this.$el.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle'); } - this.transform_widget_many2many(); + instance.web_kanban.KanbanView.postprocessing_widget_many2many_tags(self); }, on_record_moved : function(record, old_group, old_index, new_group, new_index) { var self = this; @@ -479,6 +448,42 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ } }); +/* +* widget for list of tags/categories +* make the rpc request for all ids/model and insert value inside .oe_tags fields +*/ +instance.web_kanban.KanbanView.postprocessing_widget_many2many_tags = function(self){ + var model_list_id={}; + + // select all widget for the kanban view or the widget inside the record + self.$el.find(".oe_form_field.oe_tags").each(function(){ + var model = $(this).attr("model"); + if(model.length){ + var data = $(this).attr("data"); + var list = data.split(","); + + //select all id (per model) + if(!model_list_id[model]) model_list_id[model]=[]; + for(var t=0;t0){ + var block = self.$el.find(".oe_form_field.oe_tags[model='" + model + "']"); + var dataset = new instance.web.DataSetSearch(self, model, self.session.context); + dataset.name_get(_.uniq( model_list_id[model] )).then( + function(result) { + for(var t=0;t'+result[t][1]+''); + } + } + ); + } + } +} + function get_class(name) { return new instance.web.Registry({'tmp' : name}).get_object("tmp"); } @@ -913,6 +918,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ self.$el.data('widget', self); self.bind_events(); self.group.compute_cards_auto_height(); + instance.web_kanban.KanbanView.postprocessing_widget_many2many_tags(self); } else { self.destroy(); }