NetItUp-CarloToso
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
17 additions and
15 deletions
-
edit_save_button/static/src/views/form/form_controller.js
|
|
@ -19,7 +19,7 @@ odoo.__DEBUG__ && console.log("Console log inside the patch function", FormContr |
|
|
|
|
|
|
|
patch(FormController.prototype, "save", { |
|
|
|
setup() { |
|
|
|
this.props.preventEdit = this.env.inDialog ? false :true; |
|
|
|
this.props.preventEdit = !this.env.inDialog; |
|
|
|
this._super(); |
|
|
|
}, |
|
|
|
|
|
|
@ -28,17 +28,19 @@ patch(FormController.prototype, "save",{ |
|
|
|
await this.model.root.switchMode("edit"); |
|
|
|
}, |
|
|
|
async saveButtonClicked(params = {}) { |
|
|
|
this._super(); |
|
|
|
if (this.env.inDialog == false){ |
|
|
|
const saved = await this._super(); |
|
|
|
if (saved) { |
|
|
|
if (!this.env.inDialog){ |
|
|
|
await this.model.root.switchMode("readonly"); |
|
|
|
} |
|
|
|
else { |
|
|
|
this.model.actionService.doAction({type: 'ir.actions.act_window_close'}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
async discard() { |
|
|
|
this._super(); |
|
|
|
if (this.env.inDialog == false){ |
|
|
|
if (!this.env.inDialog){ |
|
|
|
await this.model.root.switchMode("readonly"); |
|
|
|
} |
|
|
|
else { |
|
|
|