diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py index 7b4310badad..32b1cebd036 100644 --- a/erpnext/controllers/recurring_document.py +++ b/erpnext/controllers/recurring_document.py @@ -16,6 +16,8 @@ month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12} def create_recurring_documents(): manage_recurring_documents("Sales Order") manage_recurring_documents("Sales Invoice") + manage_recurring_documents("Purchase Order") + manage_recurring_documents("Purchase Invoice") def manage_recurring_documents(doctype, next_date=None, commit=True): """ @@ -28,6 +30,10 @@ def manage_recurring_documents(doctype, next_date=None, commit=True): date_field = "transaction_date" elif doctype == "Sales Invoice": date_field = "posting_date" + elif doctype == "Purchase Order": + date_field = "transaction_date" + elif doctype == "Purchase Invoice": + date_field = "posting_date" recurring_documents = frappe.db.sql("""select name, recurring_id from `tab{}` where ifnull(is_recurring, 0)=1