[minor] auto close opportunity after 7 days
This commit is contained in:
parent
de45b0eddc
commit
e1e25a0c9d
@ -245,3 +245,13 @@ def set_multiple_status(names, status):
|
||||
opp = frappe.get_doc("Opportunity", name)
|
||||
opp.status = status
|
||||
opp.save()
|
||||
|
||||
def auto_close_opportunity():
|
||||
""" auto close the `Replied` Opportunities after 7 days """
|
||||
opportunities = frappe.db.sql(""" select name from tabOpportunity where status='Replied' and
|
||||
modified<DATE_SUB(CURDATE(), INTERVAL 7 DAY) """, as_dict=True)
|
||||
|
||||
for opportunity in opportunities:
|
||||
doc = frappe.get_doc("Opportunity", opportunity.get("name"))
|
||||
doc.status = "Closed"
|
||||
doc.save(ignore_permissions=True)
|
@ -164,6 +164,7 @@ scheduler_events = {
|
||||
"erpnext.stock.reorder_item.reorder_item",
|
||||
"erpnext.setup.doctype.email_digest.email_digest.send",
|
||||
"erpnext.support.doctype.issue.issue.auto_close_tickets",
|
||||
"erpnext.crm.doctype.opportunity.opportunity.auto_close_opportunity",
|
||||
"erpnext.controllers.accounts_controller.update_invoice_status",
|
||||
"erpnext.accounts.doctype.fiscal_year.fiscal_year.auto_create_fiscal_year",
|
||||
"erpnext.hr.doctype.employee.employee.send_birthday_reminders",
|
||||
|
@ -370,4 +370,5 @@ erpnext.patches.v7_2.set_null_value_to_fields
|
||||
erpnext.patches.v7_2.update_guardian_name_in_student_master
|
||||
erpnext.patches.v7_2.update_abbr_in_salary_slips
|
||||
erpnext.patches.v7_2.rename_evaluation_criteria
|
||||
erpnext.patches.v7_2.update_party_type
|
||||
erpnext.patches.v7_2.update_party_type
|
||||
execute:frappe.db.sql("update `tabOpportunity` set status='Closed' where status='Replied' and date_sub(curdate(), interval 7 Day)>modified")
|
@ -129,7 +129,7 @@ erpnext.utils.get_contact_details = function(frm) {
|
||||
|
||||
if(frm.doc["contact_person"]) {
|
||||
frappe.call({
|
||||
method: "erpnext.utilities.doctype.contact.contact.get_contact_details",
|
||||
method: "frappe.email.doctype.contact.contact.get_contact_details",
|
||||
args: {contact: frm.doc.contact_person },
|
||||
callback: function(r) {
|
||||
if(r.message)
|
||||
|
Loading…
x
Reference in New Issue
Block a user