|
@ -18,14 +18,14 @@ const viewRegistry = registry.category("views"); |
|
|
odoo.__DEBUG__ && console.log("Console log inside the patch function", FormController.prototype, "form_controller"); |
|
|
odoo.__DEBUG__ && console.log("Console log inside the patch function", FormController.prototype, "form_controller"); |
|
|
var data = false; |
|
|
var data = false; |
|
|
|
|
|
|
|
|
patch(FormController.prototype, "save",{ |
|
|
patch(FormController.prototype, "save", { |
|
|
setup() { |
|
|
setup() { |
|
|
data = false; |
|
|
data = false; |
|
|
this.props.preventEdit = !data |
|
|
this.props.preventEdit = !data |
|
|
this._super(); |
|
|
this._super(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
async edit(){ |
|
|
async edit() { |
|
|
this._super(); |
|
|
this._super(); |
|
|
data = true; |
|
|
data = true; |
|
|
await this.model.root.switchMode("edit"); |
|
|
await this.model.root.switchMode("edit"); |
|
@ -35,7 +35,7 @@ patch(FormController.prototype, "save",{ |
|
|
data = false; |
|
|
data = false; |
|
|
await this.model.root.switchMode("readonly"); |
|
|
await this.model.root.switchMode("readonly"); |
|
|
}, |
|
|
}, |
|
|
async discard(){ |
|
|
async discard() { |
|
|
this._super(); |
|
|
this._super(); |
|
|
data = false; |
|
|
data = false; |
|
|
await this.model.root.switchMode("readonly"); |
|
|
await this.model.root.switchMode("readonly"); |
|
@ -43,7 +43,7 @@ patch(FormController.prototype, "save",{ |
|
|
async beforeLeave() { |
|
|
async beforeLeave() { |
|
|
if (this.model.root.isDirty) { |
|
|
if (this.model.root.isDirty) { |
|
|
if (confirm("The changes you have made will save Automatically!")) { |
|
|
if (confirm("The changes you have made will save Automatically!")) { |
|
|
return this.model.root.save({noReload: true, stayInEdition: true}); |
|
|
return this.model.root.save({ noReload: true, stayInEdition: true }); |
|
|
} else { |
|
|
} else { |
|
|
this.model.root.discard(); |
|
|
this.model.root.discard(); |
|
|
return true; |
|
|
return true; |
|
|