-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(patch): add patch for updating HD Team
- Loading branch information
1 parent
8be9bcb
commit ef3d3e8
Showing
2 changed files
with
23 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import frappe | ||
|
||
|
||
def execute(): | ||
teams = frappe.get_all("HD Team", pluck="name") | ||
for team in teams: | ||
existing_agents = frappe.get_all( | ||
"HD Team Item", filters={"team": team}, pluck="parent" | ||
) | ||
team_users = frappe.get_all( | ||
"HD Team Member", filters={"parent": team}, pluck="user" | ||
) | ||
|
||
for agent in existing_agents: | ||
if agent not in team_users: | ||
team_doc = ( | ||
frappe.get_doc("HD Team", team) | ||
.append("users", {"user": agent}) | ||
.save() | ||
) | ||
print("Agent Added") |