Merge pull request #18105 from hrwX/issue-fix
fix: remove frm call for priority change
This commit is contained in:
commit
0aa4e40edf
@ -607,3 +607,4 @@ execute:frappe.delete_doc_if_exists("Page", "support-analytics")
|
||||
erpnext.patches.v12_0.make_item_manufacturer
|
||||
erpnext.patches.v12_0.set_quotation_status
|
||||
erpnext.patches.v12_0.set_priority_for_support
|
||||
erpnext.patches.v12_0.delete_priority_property_setter
|
||||
|
9
erpnext/patches/v12_0/delete_priority_property_setter.py
Normal file
9
erpnext/patches/v12_0/delete_priority_property_setter.py
Normal file
@ -0,0 +1,9 @@
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.db.sql("""
|
||||
DELETE FROM `tabProperty Setter`
|
||||
WHERE `tabProperty Setter`.doc_type='Issue'
|
||||
AND `tabProperty Setter`.field_name='priority'
|
||||
AND `tabProperty Setter`.property='options'
|
||||
""")
|
@ -73,27 +73,6 @@ frappe.ui.form.on("Issue", {
|
||||
}
|
||||
},
|
||||
|
||||
priority: function(frm) {
|
||||
if (frm.doc.service_level_agreement) {
|
||||
frm.call('change_service_level_agreement_and_priority', {
|
||||
"priority": frm.doc.priority,
|
||||
"service_level_agreement": frm.doc.service_level_agreement
|
||||
}).then(() => {
|
||||
frappe.msgprint(__("Issue Priority changed to {0}.", [frm.doc.priority]));
|
||||
frm.refresh();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
service_level_agreement: function(frm) {
|
||||
frm.call('change_service_level_agreement_and_priority', {
|
||||
"service_level_agreement": frm.doc.service_level_agreement
|
||||
}).then(() => {
|
||||
frappe.msgprint(__("Service Level Agreement changed to {0}.", [frm.doc.service_level_agreement]));
|
||||
frm.refresh();
|
||||
});
|
||||
},
|
||||
|
||||
timeline_refresh: function(frm) {
|
||||
// create button for "Help Article"
|
||||
if(frappe.model.can_create('Help Article')) {
|
||||
|
@ -29,6 +29,7 @@ class Issue(Document):
|
||||
if not self.raised_by:
|
||||
self.raised_by = frappe.session.user
|
||||
|
||||
self.change_service_level_agreement_and_priority()
|
||||
self.update_status()
|
||||
self.set_lead_contact(self.raised_by)
|
||||
|
||||
@ -173,9 +174,14 @@ class Issue(Document):
|
||||
self.response_by_variance = round(time_diff_in_hours(self.response_by, now_datetime()))
|
||||
self.resolution_by_variance = round(time_diff_in_hours(self.resolution_by, now_datetime()))
|
||||
|
||||
def change_service_level_agreement_and_priority(self, priority=None, service_level_agreement=None):
|
||||
self.set_response_and_resolution_time(priority=priority, service_level_agreement=service_level_agreement)
|
||||
self.save(ignore_permissions=True)
|
||||
def change_service_level_agreement_and_priority(self):
|
||||
if not self.priority == frappe.db.get_value("Issue", self.name, "priority"):
|
||||
self.set_response_and_resolution_time(priority=self.priority, service_level_agreement=self.service_level_agreement)
|
||||
frappe.msgprint("Priority has been updated.")
|
||||
|
||||
if not self.service_level_agreement == frappe.db.get_value("Issue", self.name, "service_level_agreement"):
|
||||
self.set_response_and_resolution_time(priority=self.priority, service_level_agreement=self.service_level_agreement)
|
||||
frappe.msgprint("Service Level Agreement has been updated.")
|
||||
|
||||
def get_expected_time_for(parameter, service_level, start_date_time):
|
||||
current_date_time = start_date_time
|
||||
|
@ -18,7 +18,7 @@ class ServiceLevelAgreement(Document):
|
||||
if self.start_date >= self.end_date:
|
||||
frappe.throw(_("Start Date of Agreement can't be greater than or equal to End Date."))
|
||||
|
||||
if self.end_date < frappe.utils.getdate():
|
||||
if self.end_date < frappe.utils.nowdate():
|
||||
frappe.throw(_("End Date of Agreement can't be less than today."))
|
||||
|
||||
if self.entity_type and self.entity:
|
||||
|
Loading…
x
Reference in New Issue
Block a user