From 014b095ede09435aec62c101634198d1730fedc2 Mon Sep 17 00:00:00 2001 From: red Date: Mon, 3 Apr 2023 19:18:40 +0800 Subject: [PATCH] improved code of hide_button.js to make it easy to inherit by other modules --- spp_change_request/static/src/js/hide_button.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spp_change_request/static/src/js/hide_button.js b/spp_change_request/static/src/js/hide_button.js index f0527fd5..81585552 100644 --- a/spp_change_request/static/src/js/hide_button.js +++ b/spp_change_request/static/src/js/hide_button.js @@ -4,6 +4,9 @@ odoo.define("spp_change_request.view_change_request_form", function (require) { var user = session.uid; FormController.include({ + getModelsToHide: function () { + return ["spp.change.request"]; + }, updateButtons: function () { this._super.apply(this, arguments); if ( @@ -13,7 +16,7 @@ odoo.define("spp_change_request.view_change_request_form", function (require) { this.renderer.state.data.create_uid && this.renderer.state.data.create_uid.data ) { - if (this.modelName === "spp.change.request") { + if (this.getModelsToHide().includes(this.modelName)) { if ( this.renderer.state.data.state === "draft" && this.renderer.state.data.assign_to_id.data.id !== user &&