fix: create poc check from mom#6134
Open
pjamsheer wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the MOM DocType server logic to create related POC Check and Task records in a more idiomatic Frappe way, and to improve assignment metadata when generating ToDo assignments.
Changes:
- Refactors POC Check creation to use
frappe.new_doc()and.append()for child tables, instead of building dicts and callingfrappe.get_doc(). - Adds an Administrator impersonation block around POC Check save (and currently also around assignment creation).
- Improves assignment creation by (a) setting
allocated_toin the assignment payload and (b) skipping Task assignment creation whenissue.useris not set.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }) | ||
|
|
||
| for attendees in self.general_attendance: | ||
| parts = attendees.attendee_name.split() |
Comment on lines
+64
to
+72
| poc_check.save(ignore_permissions=True) | ||
| mom_user = frappe.get_value("Employee",self.supervisor,'user_id') | ||
| if mom_user: | ||
| add_assignment({ | ||
| 'doctype': "POC Check", | ||
| 'name': poc_check.name, | ||
| 'assign_to': [mom_user], | ||
| 'allocated_to': mom_user, | ||
| 'description':f"Kindly fill and submit this document to update the POC details for Site: {self.site} and Project: {self.project}", |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors how POC Check documents are created and improves assignment handling in the
mom.pyfile. The main changes focus on better document creation practices, more robust user context management, and ensuring assignment fields are properly set.POC Check creation and assignment improvements:
frappe.new_docand direct.appendcalls for child tables, instead of manually building dicts. This makes the code more idiomatic and less error-prone.allocated_tofield, ensuring clearer assignment tracking.Task assignment improvements:
allocated_tofield when assigning tasks, providing better clarity on who is responsible for each task.