Skip to content

fix: create poc check from mom#6134

Open
pjamsheer wants to merge 1 commit into
version-15from
mom_poc_check
Open

fix: create poc check from mom#6134
pjamsheer wants to merge 1 commit into
version-15from
mom_poc_check

Conversation

@pjamsheer

Copy link
Copy Markdown
Contributor

This pull request refactors how POC Check documents are created and improves assignment handling in the mom.py file. 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:

  • Changed POC Check creation to use frappe.new_doc and direct .append calls for child tables, instead of manually building dicts. This makes the code more idiomatic and less error-prone.
  • Ensured the document is saved as the Administrator (with permissions bypassed), then restored the original user context, improving security and consistency.
  • Updated assignment creation for POC Checks to include the allocated_to field, ensuring clearer assignment tracking.

Task assignment improvements:

  • Updated task assignment logic to set the allocated_to field when assigning tasks, providing better clarity on who is responsible for each task.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 calling frappe.get_doc().
  • Adds an Administrator impersonation block around POC Check save (and currently also around assignment creation).
  • Improves assignment creation by (a) setting allocated_to in the assignment payload and (b) skipping Task assignment creation when issue.user is 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}",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants