-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: hide custom workspaces (LAN-45) (#232)
Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
- Loading branch information
1 parent
9769ff0
commit 03864ec
Showing
4 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import frappe | ||
|
||
from landa.workspace import LANDA_WORKSPACES | ||
|
||
|
||
def execute(): | ||
"""Hide custom reports in existing customized landa workspaces.""" | ||
for workspace in frappe.get_all( | ||
"Workspace", | ||
filters={ | ||
"for_user": ("is", "set"), | ||
"hide_custom": 0, | ||
"extends": ("in", LANDA_WORKSPACES), | ||
}, | ||
pluck="name", | ||
): | ||
frappe.db.set_value("Workspace", workspace, "hide_custom", 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from frappe.desk.doctype.workspace.workspace import Workspace | ||
|
||
LANDA_WORKSPACES = ( | ||
"Water Body Management", | ||
"Organization Management", | ||
"Order Management", | ||
) | ||
|
||
|
||
def validate(doc: Workspace, method=None) -> None: | ||
# Custom reports (possibly of other users) should not be visible | ||
if doc.for_user and doc.hide_custom == 0 and doc.extends in LANDA_WORKSPACES: | ||
doc.hide_custom = 1 |