[IMP] Passed m2o values when save the records.
bzr revid: sma@tinyerp.com-20110503085044-ipqgfoo2her4nwuz
This commit is contained in:
parent
9be03eaf9e
commit
abd08b620e
|
@ -842,6 +842,7 @@ openerp.base.form.FieldMany2One = openerp.base.form.Field.extend({
|
|||
this.$element = $('#' + this.element_id);
|
||||
this.dataset = new openerp.base.form.FieldMany2OneDatasSet(this.session, this.field.relation);
|
||||
new openerp.base.m2o(this.$element, this.field.relation, this.dataset, this.session)
|
||||
this.$element.find('input').change(this.on_ui_change);
|
||||
},
|
||||
set_value: function(value) {
|
||||
this._super.apply(this, arguments);
|
||||
|
@ -851,8 +852,16 @@ openerp.base.form.FieldMany2One = openerp.base.form.Field.extend({
|
|||
this.value = value[0];
|
||||
}
|
||||
this.$element.find('input').val(show_value);
|
||||
// Need to replace this `text` with original `id` after discuss with xmo
|
||||
this.$element.find('input').attr('text', this.value);
|
||||
this.$element.find('input').attr('m2o_id', this.value);
|
||||
},
|
||||
|
||||
get_value: function() {
|
||||
var val = this.$element.find('input').attr('m2o_id') || this.value
|
||||
return val;
|
||||
},
|
||||
|
||||
on_ui_change: function() {
|
||||
this.touched = this.view.touched = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -198,6 +198,9 @@ openerp.base.m2o = openerp.base.Controller.extend({
|
|||
var event_list = new openerp.base.ListView(this.view_manager, this.session, element_id, this.dataset, false);
|
||||
event_list.start();
|
||||
event_list.do_reload();
|
||||
}
|
||||
if ($selectedRow.find('td').attr('id') == 'create') {
|
||||
|
||||
}
|
||||
this.setCompletionText($selectedRow, true);
|
||||
this.clearResults();
|
||||
|
@ -274,6 +277,7 @@ openerp.base.m2o = openerp.base.Controller.extend({
|
|||
var autoCompleteText = $cell.find('span').text();
|
||||
autoCompleteText = flag ? autoCompleteText : this.lastSearch + '[' + autoCompleteText.substring(this.lastSearch.length) + ']'
|
||||
this.element.val(autoCompleteText);
|
||||
this.element.attr('m2o_id', $cell.attr('data-id'));
|
||||
this.lastTextResult = autoCompleteText;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue