Allow Reference to be edited from tree view

issue10999
review384831002
This commit is contained in:
Cédric Krier
2022-04-11 21:11:13 +02:00
parent 02d7d1fad3
commit 1f2db88eff
2 changed files with 27 additions and 0 deletions
+1
View File
@@ -1,3 +1,4 @@
* Allow Reference to be edited from tree view
* Set ECMAScript version to 6
* Manage optional column
* Display the number of selected records
+26
View File
@@ -2587,7 +2587,17 @@
Sao.common.selection_mixin.update_selection.call(this, record,
this.field, callback);
},
get_cell: function() {
var cell = Sao.View.Tree.ReferenceColumn._super
.get_cell.call(this);
cell.append(jQuery('<a/>', {
'href': '#',
}));
return cell;
},
update_text: function(cell, record) {
cell = cell.children('a');
cell.unbind('click');
this.update_selection(record, function() {
var value = this.field.get_client(record);
var model, name, text;
@@ -2610,6 +2620,22 @@
text = name;
}
cell.text(text).attr('title', text);
cell.click(function(event) {
event.stopPropagation();
var value = this.field.get(record);
if (value) {
var model = value.split(',')[0];
var id = parseInt(value.split(',')[1], 10);
var params = {
model: model,
res_id: id,
mode: ['form'],
name: this.attributes.string,
context: this.field.get_context(record),
};
Sao.Tab.create(params);
}
}.bind(this));
}.bind(this));
}
});