From c32249a72f4201eb4209f56c0d16f99475df656d Mon Sep 17 00:00:00 2001 From: Chinmay Pai Date: Tue, 21 Jan 2020 14:12:49 +0530 Subject: [PATCH] fix: Set Quotation expired if not Ordered or Lost (#20365) Co-authored-by: Chinmay Pai Co-authored-by: KanchanChauhan --- erpnext/selling/doctype/quotation/quotation.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 488331a8102..00471c762c8 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -185,8 +185,12 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False): return doclist def set_expired_status(): - frappe.db.sql("""UPDATE `tabQuotation` SET `status` = 'Expired' - WHERE `status` != "Expired" AND `valid_till` < %s""", (nowdate())) + frappe.db.sql(""" + UPDATE + `tabQuotation` SET `status` = 'Expired' + WHERE + `status` not in ('Ordered', 'Expired', 'Lost', 'Cancelled') AND `valid_till` < %s + """, (nowdate())) @frappe.whitelist() def make_sales_invoice(source_name, target_doc=None):