Get initial value only when cancel button is on window form

The initial value is only useful with the view type is form otherwise screen
may not have a current record like in Attachment.

issue7377
review36221002
This commit is contained in:
Cédric Krier
2018-04-20 18:38:15 +02:00
parent a9dd3203b0
commit fed8553feb
+4 -5
View File
@@ -86,9 +86,12 @@
this._initial_value = null;
if (view_type == 'form') {
var button_text = Sao.i18n.gettext('Cancel');
var button_text;
if (kwargs.new_) {
button_text = Sao.i18n.gettext('Delete');
} else {
button_text = Sao.i18n.gettext('Cancel');
this._initial_value = this.screen.current_record.get_eval();
}
dialog.footer.append(jQuery('<button/>', {
@@ -245,10 +248,6 @@
this.el.on('hidden.bs.modal', function(event) {
jQuery(this).remove();
});
if (!kwargs.new_) {
this._initial_value = this.screen.current_record.get_eval();
}
},
add: function() {
var domain = jQuery.extend([], this.domain);