-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28550 from nextchamp-saqib/fix-sla
refactor(SLA): Application of SLA and its fields
- Loading branch information
Showing
13 changed files
with
475 additions
and
386 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
27 changes: 27 additions & 0 deletions
27
erpnext/patches/v14_0/rename_ongoing_status_in_sla_documents.py
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,27 @@ | ||
import frappe | ||
|
||
|
||
def execute(): | ||
active_sla_documents = [sla.document_type for sla in frappe.get_all("Service Level Agreement", fields=["document_type"])] | ||
|
||
for doctype in active_sla_documents: | ||
doctype = frappe.qb.DocType(doctype) | ||
try: | ||
frappe.qb.update( | ||
doctype | ||
).set( | ||
doctype.agreement_status, 'First Response Due' | ||
).where( | ||
doctype.first_responded_on.isnull() | ||
).run() | ||
|
||
frappe.qb.update( | ||
doctype | ||
).set( | ||
doctype.agreement_status, 'Resolution Due' | ||
).where( | ||
doctype.agreement_status == 'Ongoing' | ||
).run() | ||
|
||
except Exception: | ||
frappe.log_error(title='Failed to Patch SLA Status') |
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
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
Oops, something went wrong.