Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #212 from OpenSPP/193092-cr-food-agent
Browse files Browse the repository at this point in the history
improved code of hide_button.js to make it easy to inherit by other m…
  • Loading branch information
gonzalesedwin1123 authored Apr 3, 2023
2 parents e7441f4 + 014b095 commit 39304ab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spp_change_request/static/src/js/hide_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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 &&
Expand Down

0 comments on commit 39304ab

Please sign in to comment.