[imp] added quick create in m2o
bzr revid: nicolas.vanhoren@openerp.com-20110610161700-dvsfbakx5gvpikrh
This commit is contained in:
commit
3613de38f7
|
@ -313,12 +313,12 @@ openerp.base.DataSet = openerp.base.Controller.extend( /** @lends openerp.base.
|
|||
// to implement in children
|
||||
this.notification.notify("Unlink", ids);
|
||||
},
|
||||
call: function (method, args, callback) {
|
||||
call: function (method, args, callback, error_callback) {
|
||||
return this.rpc('/base/dataset/call', {
|
||||
model: this.model,
|
||||
method: method,
|
||||
args: args || []
|
||||
}, callback);
|
||||
}, callback, error_callback);
|
||||
},
|
||||
name_search: function (search_str, limit, callback) {
|
||||
search_str = search_str || '';
|
||||
|
|
|
@ -1143,8 +1143,7 @@ openerp.base.form.FieldMany2One = openerp.base.form.Field.extend({
|
|||
if (self.value === undefined) {
|
||||
values.push({label: '<em> Create "<strong>' +
|
||||
$('<span />').text(search_val).html() + '</strong>"</em>', action: function() {
|
||||
self._change_int_value(null);
|
||||
self._search_create_popup("form");
|
||||
self._quick_create(search_val);
|
||||
}});
|
||||
}
|
||||
values.push({label: "<em> Create and Edit...</em>", action: function() {
|
||||
|
@ -1155,6 +1154,16 @@ openerp.base.form.FieldMany2One = openerp.base.form.Field.extend({
|
|||
response(values);
|
||||
});
|
||||
},
|
||||
_quick_create: function(name) {
|
||||
var self = this;
|
||||
var dataset = new openerp.base.DataSetStatic(this.session, this.field.relation, []);
|
||||
dataset.call("name_create", [name, {}], function(data) {
|
||||
self._change_int_ext_value(data.result);
|
||||
}, function(a, b) {
|
||||
self._change_int_value(null);
|
||||
self._search_create_popup("form");
|
||||
});
|
||||
},
|
||||
// all search/create popup handling
|
||||
_search_create_popup: function(view, ids) {
|
||||
var dataset = new openerp.base.DataSetStatic(this.session, this.field.relation, []);
|
||||
|
|
Loading…
Reference in New Issue