[IMP] Calendar: No need to do default_get by hand

The form will already do a default_get on do_show() when index is null

bzr revid: fme@openerp.com-20111205095843-7ll9yna17dnltx6v
This commit is contained in:
Fabien Meghazi 2011-12-05 10:58:43 +01:00
parent 8aadbe5288
commit d7cab28455
1 changed files with 13 additions and 16 deletions

View File

@ -263,24 +263,21 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({
data = this.get_event_data(event_obj),
form = self.form_dialog.form,
fields_to_fetch = _(form.fields_view.fields).keys();
this.dataset.index = null;
self.creating_event_id = event_id;
self.dataset.default_get(fields_to_fetch, function(default_values) {
form.on_record_loaded(default_values).then(function() {
form.show_invalid = false;
_.each(['date_start', 'date_stop', 'date_delay'], function(field) {
var field_name = self[field];
if (field_name) {
field = form.fields[field_name];
field.set_value(data[field_name]);
field.dirty = true;
form.do_onchange(field);
}
});
form.show_invalid = true;
form.do_show().then(function() {
self.form_dialog.open();
});
this.form_dialog.form.do_show().then(function() {
form.show_invalid = false;
_.each(['date_start', 'date_stop', 'date_delay'], function(field) {
var field_name = self[field];
if (field_name) {
field = form.fields[field_name];
field.set_value(data[field_name]);
field.dirty = true;
form.do_onchange(field);
}
});
form.show_invalid = true;
self.form_dialog.open();
});
},
do_save_event: function(event_id, event_obj) {