this.fields_order = [];
this.datarecord = {};
this._onchange_specs = {};
+ this.onchanges_defs = [];
this.default_focus_field = null;
this.default_focus_button = null;
this.fields_registry = instance.web.form.widgets;
def = self.alive(new instance.web.Model(self.dataset.model).call(
"onchange", [ids, values, trigger_field_name, onchange_specs, context]));
}
- return def.then(function(response) {
+ var onchange_def = def.then(function(response) {
if (widget && widget.field['change_default']) {
var fieldname = widget.name;
var value_;
}).then(function(response) {
return self.on_processed_onchange(response);
});
+ this.onchanges_defs.push(onchange_def);
+ return onchange_def;
} catch(e) {
console.error(e);
instance.webclient.crashmanager.show_message(e);
* if the current record is not yet saved. It will then stay in create mode.
*/
to_edit_mode: function() {
+ this.onchanges_defs = [];
this._actualize_mode("edit");
},
/**
var self = this;
var save_obj = {prepend_on_create: prepend_on_create, ret: null};
this.save_list.push(save_obj);
- return this._process_operations().then(function() {
- if (save_obj.error)
- return $.Deferred().reject();
- return $.when.apply($, save_obj.ret);
- }).done(function() {
- self.$el.removeClass('oe_form_dirty');
+ return $.when.apply($, self.onchanges_defs).then(function(){
+ return self._process_operations().then(function() {
+ if (save_obj.error)
+ return $.Deferred().reject();
+ return $.when.apply($, save_obj.ret);
+ }).done(function() {
+ self.$el.removeClass('oe_form_dirty');
+ });
});
},
_process_save: function(save_obj) {
mock('test.model:create', function () {
return 42;
});
+ mock('test.model:onchange', function () {
+ return {};
+ });
}
}, function (test) {
/**
arch: '<tree><field name="a"/><field name="b"/><field name="c"/></tree>',
};
});
+ mock('demo:onchange', function () {
+ return {};
+ });
}
}, function (test) {
test('newrecord', {asserts: 6}, function (instance, $fix, mock) {
dependencies: ['web.list_editable'],
rpc: 'mock',
templates: true,
+ setup: function (instance, $s, mock) {
+ mock('demo:onchange', function () {
+ return {};
+ });
+ }
}, function (test) {
test('record-to-read', {asserts: 4}, function (instance, $fix, mock) {
mock('demo:fields_view_get', function () {