Add status expired to doctype quotation
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 9e74bfd..715839c 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -301,7 +301,8 @@
"erpnext.quality_management.doctype.quality_review.quality_review.review",
"erpnext.support.doctype.service_level_agreement.service_level_agreement.check_agreement_status",
"erpnext.crm.doctype.email_campaign.email_campaign.send_email_to_leads_or_contacts",
- "erpnext.crm.doctype.email_campaign.email_campaign.set_email_campaign_status"
+ "erpnext.crm.doctype.email_campaign.email_campaign.set_email_campaign_status",
+ "erpnext.selling.doctype.quotation.set_expired"
],
"daily_long": [
"erpnext.setup.doctype.email_digest.email_digest.send",
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 4a56e40..82e9827 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -185,6 +185,14 @@
return doclist
+def set_expired_status():
+ quotations = frappe.get_all("Quotation")
+ for quotation in quotations:
+ quotation = frappe.get_doc("Quotation",quotation.name)
+ if quotation.valid_till and getdate(quotation.valid_till) < getdate(nowdate()):
+ frappe.db.set(quotation,'status','Expired')
+ frappe.db.commit()
+
@frappe.whitelist()
def make_sales_invoice(source_name, target_doc=None):
return _make_sales_invoice(source_name, target_doc)
diff --git a/erpnext/selling/doctype/quotation/quotation_list.js b/erpnext/selling/doctype/quotation/quotation_list.js
index 5f4e254..802c0ba 100644
--- a/erpnext/selling/doctype/quotation/quotation_list.js
+++ b/erpnext/selling/doctype/quotation/quotation_list.js
@@ -14,15 +14,13 @@
get_indicator: function(doc) {
if(doc.status==="Open") {
- if (doc.valid_till && doc.valid_till < frappe.datetime.nowdate()) {
- return [__("Expired"), "darkgrey", "valid_till,<," + frappe.datetime.nowdate()];
- } else {
- return [__("Open"), "orange", "status,=,Open"];
- }
+ return [__("Open"), "orange", "status,=,Open"];
} else if(doc.status==="Ordered") {
return [__("Ordered"), "green", "status,=,Ordered"];
} else if(doc.status==="Lost") {
return [__("Lost"), "darkgrey", "status,=,Lost"];
+ } else if(doc.status==="Expired") {
+ return [__("Expired"), "darkgrey", "status,=,Expired"];
}
}
};