[MERGE] merge notes from chm
bzr revid: fp@tinyerp.com-20120919064431-ne3w7ck6afl2ptsl
This commit is contained in:
commit
cfa035e25a
|
@ -143,6 +143,10 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
}
|
}
|
||||||
|
.openerp .oe_kanban_view .oe_kanban_add, .openerp .oe_kanban_view .oe_kanban_card .oe_dropdown_toggle {
|
||||||
|
cursor: pointer;
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
.openerp .oe_kanban_view .oe_kanban_add {
|
.openerp .oe_kanban_view .oe_kanban_add {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,9 @@
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
position: relative
|
position: relative
|
||||||
top: -8px
|
top: -8px
|
||||||
|
.oe_kanban_card, .oe_dropdown_toggle
|
||||||
|
cursor: pointer
|
||||||
|
display:inline-block
|
||||||
.oe_kanban_add
|
.oe_kanban_add
|
||||||
float: right
|
float: right
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
|
||||||
this.fields_keys = _.keys(this.fields_view.fields);
|
this.fields_keys = _.keys(this.fields_view.fields);
|
||||||
this.add_qweb_template();
|
this.add_qweb_template();
|
||||||
this.has_been_loaded.resolve();
|
this.has_been_loaded.resolve();
|
||||||
|
this._super.apply(this, arguments);
|
||||||
return $.when();
|
return $.when();
|
||||||
},
|
},
|
||||||
_is_quick_create_enabled: function() {
|
_is_quick_create_enabled: function() {
|
||||||
|
@ -85,6 +86,9 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
|
||||||
return false;
|
return false;
|
||||||
return this._super(action);
|
return this._super(action);
|
||||||
},
|
},
|
||||||
|
/* add_qweb_template
|
||||||
|
* select the nodes into the xml and send to extract_aggregates the nodes with TagName="field"
|
||||||
|
*/
|
||||||
add_qweb_template: function() {
|
add_qweb_template: function() {
|
||||||
for (var i=0, ii=this.fields_view.arch.children.length; i < ii; i++) {
|
for (var i=0, ii=this.fields_view.arch.children.length; i < ii; i++) {
|
||||||
var child = this.fields_view.arch.children[i];
|
var child = this.fields_view.arch.children[i];
|
||||||
|
@ -97,6 +101,9 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/* extract_aggregates
|
||||||
|
* extract the agggregates from the nodes (TagName="field")
|
||||||
|
*/
|
||||||
extract_aggregates: function(node) {
|
extract_aggregates: function(node) {
|
||||||
for (var j = 0, jj = this.group_operators.length; j < jj; j++) {
|
for (var j = 0, jj = this.group_operators.length; j < jj; j++) {
|
||||||
if (node.attrs[this.group_operators[j]]) {
|
if (node.attrs[this.group_operators[j]]) {
|
||||||
|
@ -121,9 +128,15 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
|
||||||
}
|
}
|
||||||
switch (node.tag) {
|
switch (node.tag) {
|
||||||
case 'field':
|
case 'field':
|
||||||
node.tag = QWeb.prefix;
|
if(this.fields_view.fields[ node.attrs['name'] ].type == 'many2many'){
|
||||||
node.attrs[QWeb.prefix + '-esc'] = 'record.' + node.attrs['name'] + '.value';
|
node.tag = 'div';
|
||||||
this.extract_aggregates(node);
|
node.attrs['class'] = 'oe_kanban_many2many_tags';
|
||||||
|
node.attrs['model'] = this.fields_view.fields[node.attrs['name']].relation;
|
||||||
|
node.attrs['t-att-data'] = 'record.' + node.attrs['name'] + '.raw_value';
|
||||||
|
}else {
|
||||||
|
node.tag = QWeb.prefix;
|
||||||
|
node.attrs[QWeb.prefix + '-esc'] = 'record.' + node.attrs['name'] + '.value';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'button':
|
case 'button':
|
||||||
case 'a':
|
case 'a':
|
||||||
|
@ -163,6 +176,37 @@ 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;t<list.length;t++) if(list[t]!="") arg[model].push( list[t] );
|
||||||
|
});
|
||||||
|
|
||||||
|
// only one request by model
|
||||||
|
for(var model in arg){
|
||||||
|
if(arg[model].length>0){
|
||||||
|
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.length;t++){
|
||||||
|
self.$el.find(".oe_kanban_many2many_tags[model='" + model + "']")
|
||||||
|
.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>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
do_add_record: function() {
|
do_add_record: function() {
|
||||||
this.dataset.index = null;
|
this.dataset.index = null;
|
||||||
this.do_switch_view('form');
|
this.do_switch_view('form');
|
||||||
|
@ -350,6 +394,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');
|
||||||
}
|
}
|
||||||
|
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;
|
||||||
|
@ -762,7 +807,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.$el.find('.oe_kanban_global_click').length) {
|
if (this.$el.find('.oe_kanban_global_click,.oe_kanban_global_click_edit').length) {
|
||||||
this.$el.on('click', function(ev) {
|
this.$el.on('click', function(ev) {
|
||||||
if (!ev.isTrigger && !$(ev.target).data('events')) {
|
if (!ev.isTrigger && !$(ev.target).data('events')) {
|
||||||
var trigger = true;
|
var trigger = true;
|
||||||
|
@ -803,8 +848,15 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/* actions when user click on the block with a specific class
|
||||||
|
* open on normal view : oe_kanban_global_click
|
||||||
|
* open on form/edit view : oe_kanban_global_click_edit
|
||||||
|
*/
|
||||||
on_card_clicked: function(ev) {
|
on_card_clicked: function(ev) {
|
||||||
this.view.open_record(this.id);
|
if(this.$el.find('.oe_kanban_global_click_edit').size()>0)
|
||||||
|
this.do_action_edit();
|
||||||
|
else
|
||||||
|
this.do_action_open();
|
||||||
},
|
},
|
||||||
setup_color_picker: function() {
|
setup_color_picker: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
Loading…
Reference in New Issue