[IMP] kanban: temp

bzr revid: chm@openerp.com-20120919074822-ytdwjw1ubai4x4lf
This commit is contained in:
Christophe Matthieu 2012-09-19 09:48:22 +02:00
parent 3ad1a96143
commit f71dd62f2b
1 changed files with 13 additions and 13 deletions

View File

@ -185,27 +185,30 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
arg={}; arg={};
// select all widget // select all widget
self.$el.find(".oe_kanban_many2many_tags").each(function(){ self.$el.find(".oe_kanban_many2many_tags").each(function(){
var model = $(this).attr("model"); var model = $(this).attr("model");
var data = $(this).attr("data"); if(model.length){
var list = data.split(","); var data = $(this).attr("data");
//select all id (per model) var list = data.split(",");
if(!arg[model]) arg[model]=[]; //select all id (per model)
for(var t=0;t<list.length;t++) if(list[t]!="") arg[model].push( list[t] ); if(!arg[model]) arg[model]=[];
for(var t=0;t<list.length;t++) if(list[t]!="") arg[model].push( list[t] );
}
}); });
// only one request by model // only one request by model
for(var model in arg){ for(var model in arg){
if(arg[model].length>0){ if(arg[model].length>0){
var block = self.$el.find(".oe_kanban_many2many_tags[model='" + model + "']");
var dataset = new instance.web.DataSetSearch(self, model, self.session.context); var dataset = new instance.web.DataSetSearch(self, model, self.session.context);
dataset.name_get(_.uniq( arg[model] )).then( dataset.name_get(_.uniq( arg[model] )).then(
function(result) { function(result) {
for(var t=0;t<result.length;t++){ for(var t=0;t<result.length;t++){
self.$el.find(".oe_kanban_many2many_tags[model='" + model + "']") block.filter(function(){ return this.getAttribute("data").match(new RegExp('(^|,)'+result[t][0]+'(,|$)')); })
.filter(function(){ return this.getAttribute("data").match(new RegExp('(^|,)'+result[t][0]+'(,|$)')); })
.append('<span class="oe_tag" data-list_id="' + result[t][0] +'"">'+result[t][1]+'</span>'); .append('<span class="oe_tag" data-list_id="' + result[t][0] +'"">'+result[t][1]+'</span>');
} }
} }
); );
console.log("kanban 212 ",block);
} }
} }
}, },
@ -396,8 +399,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
} else { } else {
this.$el.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle'); this.$el.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle');
} }
self.transform_widget_many2many();
this.transform_widget_many2many();
}, },
on_record_moved : function(record, old_group, old_index, new_group, new_index) { on_record_moved : function(record, old_group, old_index, new_group, new_index) {
var self = this; var self = this;
@ -416,6 +418,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
this.dataset.write(record.id, data, {}, function() { this.dataset.write(record.id, data, {}, function() {
record.do_reload(); record.do_reload();
new_group.do_save_sequences(); new_group.do_save_sequences();
self.transform_widget_many2many();
}).fail(function(error, evt) { }).fail(function(error, evt) {
evt.preventDefault(); evt.preventDefault();
alert("An error has occured while moving the record to this group."); alert("An error has occured while moving the record to this group.");
@ -732,9 +735,6 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({
transform_record: function(record) { transform_record: function(record) {
var self = this, var self = this,
new_record = {}; new_record = {};
console.log(this, record);
_.each(record, function(value, name) { _.each(record, function(value, name) {
var r = _.clone(self.view.fields_view.fields[name] || {}); var r = _.clone(self.view.fields_view.fields[name] || {});
if ((r.type === 'date' || r.type === 'datetime') && value) { if ((r.type === 'date' || r.type === 'datetime') && value) {