From ad03eb25df6c07beb744a0fe3003a4c6fb19b98e Mon Sep 17 00:00:00 2001 From: Ganga Manoj Date: Tue, 5 Oct 2021 12:26:59 +0530 Subject: [PATCH 1/2] fix: Only calculate first_respone_time if SLA is set (#27789) Co-authored-by: Afshan <33727827+AfshanKhan@users.noreply.github.com> --- erpnext/support/doctype/issue/issue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py index 7d7399d097..0fe1068a76 100644 --- a/erpnext/support/doctype/issue/issue.py +++ b/erpnext/support/doctype/issue/issue.py @@ -228,7 +228,7 @@ def get_time_in_timedelta(time): def set_first_response_time(communication, method): if communication.get('reference_doctype') == "Issue": issue = get_parent_doc(communication) - if is_first_response(issue): + if is_first_response(issue) and issue.service_level_agreement: first_response_time = calculate_first_response_time(issue, get_datetime(issue.first_responded_on)) issue.db_set("first_response_time", first_response_time) From 7da777880bea281bd6612a3b229dd944feccf8ee Mon Sep 17 00:00:00 2001 From: Alan <2.alan.tom@gmail.com> Date: Tue, 5 Oct 2021 12:35:23 +0530 Subject: [PATCH 2/2] fix: add (uom, brand) Item details in an Item Price (#27561) * fix: add (uom, brand) and update (uom) Item details in an Item Price * fix: order of query interpolation args Co-authored-by: Marica * fix: named interpolation, remove item price * fix: sql error Co-authored-by: Marica Co-authored-by: Ankush Menat --- erpnext/stock/doctype/item/item.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 768e5eae2d..8cc9f74a42 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -181,6 +181,8 @@ class Item(WebsiteGenerator): "doctype": "Item Price", "price_list": price_list, "item_code": self.name, + "uom": self.stock_uom, + "brand": self.brand, "currency": erpnext.get_default_currency(), "price_list_rate": self.standard_rate }) @@ -634,9 +636,21 @@ class Item(WebsiteGenerator): _("An Item Group exists with same name, please change the item name or rename the item group")) def update_item_price(self): - frappe.db.sql("""update `tabItem Price` set item_name=%s, - item_description=%s, brand=%s where item_code=%s""", - (self.item_name, self.description, self.brand, self.name)) + frappe.db.sql(""" + UPDATE `tabItem Price` + SET + item_name=%(item_name)s, + item_description=%(item_description)s, + brand=%(brand)s + WHERE item_code=%(item_code)s + """, + dict( + item_name=self.item_name, + item_description=self.description, + brand=self.brand, + item_code=self.name + ) + ) def on_trash(self): super(Item, self).on_trash()