[IMP] Improove code for form view bounce effect

bzr revid: pan@tinyerp.com-20120705065757-483b5y765cvupail
This commit is contained in:
Anand Patel (OpenERP) 2012-07-05 12:27:57 +05:30
parent a2087dc4c5
commit 202238473c
1 changed files with 7 additions and 2 deletions

View File

@ -284,8 +284,8 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
} }
this._super(); this._super();
}, },
on_record_loaded: function(record) { on_invalidclick : function (){
var self = this, set_values = []; var self = this;
var div = $("<div />", {id:"bounce"}); var div = $("<div />", {id:"bounce"});
this.$element.find(".oe_form_field").click(function () { this.$element.find(".oe_form_field").click(function () {
$(".oe_form_button_edit").wrap(div); $(".oe_form_button_edit").wrap(div);
@ -293,6 +293,10 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
var val_bounce = $(".oe_form_button_edit"); var val_bounce = $(".oe_form_button_edit");
self.do_bounce(val_bounce); self.do_bounce(val_bounce);
}); });
},
on_record_loaded: function(record) {
var self = this, set_values = [];
self.on_invalidclick();
if (!record) { if (!record) {
this.do_warn("Form", "The record could not be found in the database.", true); this.do_warn("Form", "The record could not be found in the database.", true);
return $.Deferred().reject(); return $.Deferred().reject();
@ -586,6 +590,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
var self = this; var self = this;
return this.do_save().then(function(result) { return this.do_save().then(function(result) {
self.set({mode: "view"}); self.set({mode: "view"});
self.on_invalidclick();
}); });
}, },
on_button_cancel: function(event) { on_button_cancel: function(event) {