Merge pull request #3552 from nabinhait/develop
Recurring docs should not consider Stopped documents and should be scheduled for hourly
This commit is contained in:
commit
2ab9d6e92c
@ -33,11 +33,13 @@ def manage_recurring_documents(doctype, next_date=None, commit=True):
|
|||||||
next_date = next_date or nowdate()
|
next_date = next_date or nowdate()
|
||||||
|
|
||||||
date_field = date_field_map[doctype]
|
date_field = date_field_map[doctype]
|
||||||
|
|
||||||
|
condition = " and ifnull(status, '') != 'Stopped'" if doctype in ("Sales Order", "Purchase Order") else ""
|
||||||
|
|
||||||
recurring_documents = frappe.db.sql("""select name, recurring_id
|
recurring_documents = frappe.db.sql("""select name, recurring_id
|
||||||
from `tab{}` where ifnull(is_recurring, 0)=1
|
from `tab{0}` where ifnull(is_recurring, 0)=1
|
||||||
and docstatus=1 and next_date='{}'
|
and docstatus=1 and next_date=%s
|
||||||
and next_date <= ifnull(end_date, '2199-12-31')""".format(doctype, next_date))
|
and next_date <= ifnull(end_date, '2199-12-31') {1}""".format(doctype, condition), next_date)
|
||||||
|
|
||||||
exception_list = []
|
exception_list = []
|
||||||
for ref_document, recurring_id in recurring_documents:
|
for ref_document, recurring_id in recurring_documents:
|
||||||
|
@ -78,8 +78,10 @@ doc_events = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scheduler_events = {
|
scheduler_events = {
|
||||||
|
"hourly": [
|
||||||
|
"erpnext.controllers.recurring_document.create_recurring_documents"
|
||||||
|
],
|
||||||
"daily": [
|
"daily": [
|
||||||
"erpnext.controllers.recurring_document.create_recurring_documents",
|
|
||||||
"erpnext.stock.reorder_item.reorder_item",
|
"erpnext.stock.reorder_item.reorder_item",
|
||||||
"erpnext.setup.doctype.email_digest.email_digest.send",
|
"erpnext.setup.doctype.email_digest.email_digest.send",
|
||||||
"erpnext.support.doctype.issue.issue.auto_close_tickets",
|
"erpnext.support.doctype.issue.issue.auto_close_tickets",
|
||||||
|
Loading…
Reference in New Issue
Block a user