update subscription period only if relevant date field exists (#11046)
diff --git a/erpnext/accounts/doctype/subscription/subscription.py b/erpnext/accounts/doctype/subscription/subscription.py
index 8745ac6..b40169a 100644
--- a/erpnext/accounts/doctype/subscription/subscription.py
+++ b/erpnext/accounts/doctype/subscription/subscription.py
@@ -142,7 +142,7 @@
def create_documents(data, schedule_date):
try:
doc = make_new_document(data, schedule_date)
- if doc.from_date:
+ if getattr(doc, "from_date", None):
update_subscription_period(data, doc)
if data.notify_by_email and data.recipients:
@@ -154,7 +154,7 @@
frappe.db.rollback()
frappe.db.begin()
frappe.log_error(frappe.get_traceback())
- disabled_subscription(data)
+ disable_subscription(data)
frappe.db.commit()
if data.reference_document and not frappe.flags.in_test:
notify_error_to_user(data)
@@ -166,7 +166,7 @@
frappe.db.set_value('Subscription', data.name, 'from_date', from_date)
frappe.db.set_value('Subscription', data.name, 'to_date', to_date)
-def disabled_subscription(data):
+def disable_subscription(data):
subscription = frappe.get_doc('Subscription', data.name)
subscription.db_set('disabled', 1)