From 850eaa73b053f34558e4ef53a01e8f03daccd372 Mon Sep 17 00:00:00 2001
From: rohitwaghchaure
Date: Fri, 15 Sep 2017 16:16:36 +0530
Subject: [PATCH] Move subscription module to accounts (#10772)
---
.../doctype/payment_entry/payment_entry.py | 7 ++-
.../doctype}/subscription/__init__.py | 0
.../doctype/subscription/subscription.js | 32 ++++++++++
.../doctype/subscription/subscription.json | 56 +++++++++++++++---
.../doctype/subscription/subscription.py | 55 +++++++++++------
.../doctype/subscription/subscription_list.js | 6 +-
.../doctype/subscription/test_subscription.js | 0
.../doctype/subscription/test_subscription.py | 2 +-
erpnext/config/accounts.py | 6 ++
.../subscription.gif | Bin
.../subscription.png | Bin
.../docs/user/manual/en/accounts/index.txt | 1 +
.../user/manual/en/accounts/subscription.md | 24 ++++++++
erpnext/hooks.py | 2 +-
erpnext/modules.txt | 3 +-
erpnext/patches.txt | 1 +
.../make_subscription_from_recurring_data.py | 2 +-
erpnext/patches/v9_0/__init__.py | 1 +
.../v9_0/remove_subscription_module.py | 9 +++
erpnext/public/js/utils.js | 2 +-
.../doctype/sales_order/sales_order.py | 7 +--
erpnext/subscription/__init__.py | 0
erpnext/subscription/doctype/__init__.py | 0
.../doctype/subscription/__init__.py | 0
.../emails/recurring_document_failed.html | 9 ++-
25 files changed, 183 insertions(+), 42 deletions(-)
rename erpnext/{docs/assets/img => accounts/doctype}/subscription/__init__.py (100%)
rename erpnext/{subscription => accounts}/doctype/subscription/subscription.js (60%)
rename erpnext/{subscription => accounts}/doctype/subscription/subscription.json (94%)
rename erpnext/{subscription => accounts}/doctype/subscription/subscription.py (82%)
rename erpnext/{subscription => accounts}/doctype/subscription/subscription_list.js (56%)
rename erpnext/{subscription => accounts}/doctype/subscription/test_subscription.js (100%)
rename erpnext/{subscription => accounts}/doctype/subscription/test_subscription.py (97%)
rename erpnext/docs/assets/img/{subscription => accounts}/subscription.gif (100%)
rename erpnext/docs/assets/img/{subscription => accounts}/subscription.png (100%)
create mode 100644 erpnext/docs/user/manual/en/accounts/subscription.md
create mode 100644 erpnext/patches/v9_0/__init__.py
create mode 100644 erpnext/patches/v9_0/remove_subscription_module.py
delete mode 100644 erpnext/subscription/__init__.py
delete mode 100644 erpnext/subscription/doctype/__init__.py
delete mode 100644 erpnext/subscription/doctype/subscription/__init__.py
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index cc5a9e6ae1..29ad83152d 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -483,9 +483,14 @@ class PaymentEntry(AccountsController):
doc = frappe.get_doc("Expense Claim", d.reference_name)
update_reimbursed_amount(doc)
+ def on_recurring(self, reference_doc, subscription_doc):
+ self.reference_no = reference_doc.name
+ self.reference_date = nowdate()
+
@frappe.whitelist()
def get_outstanding_reference_documents(args):
- args = json.loads(args)
+ if isinstance(args, basestring):
+ args = json.loads(args)
party_account_currency = get_account_currency(args.get("party_account"))
company_currency = frappe.db.get_value("Company", args.get("company"), "default_currency")
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/accounts/doctype/subscription/__init__.py
similarity index 100%
rename from erpnext/docs/assets/img/subscription/__init__.py
rename to erpnext/accounts/doctype/subscription/__init__.py
diff --git a/erpnext/subscription/doctype/subscription/subscription.js b/erpnext/accounts/doctype/subscription/subscription.js
similarity index 60%
rename from erpnext/subscription/doctype/subscription/subscription.js
rename to erpnext/accounts/doctype/subscription/subscription.js
index 0b2b2fa83a..c9b3c6480d 100644
--- a/erpnext/subscription/doctype/subscription/subscription.js
+++ b/erpnext/accounts/doctype/subscription/subscription.js
@@ -40,6 +40,38 @@ frappe.ui.form.on('Subscription', {
frappe.set_route("List", frm.doc.reference_doctype);
}
);
+
+ if(frm.doc.status != 'Stopped') {
+ frm.add_custom_button(__("Stop"),
+ function() {
+ frm.events.stop_resume_subscription(frm, "Stopped");
+ }
+ );
+ }
+
+ if(frm.doc.status == 'Stopped') {
+ frm.add_custom_button(__("Resume"),
+ function() {
+ frm.events.stop_resume_subscription(frm, "Resumed");
+ }
+ );
+ }
}
+ },
+
+ stop_resume_subscription: function(frm, status) {
+ frappe.call({
+ method: "erpnext.accounts.doctype.subscription.subscription.stop_resume_subscription",
+ args: {
+ subscription: frm.doc.name,
+ status: status
+ },
+ callback: function(r) {
+ if(r.message) {
+ frm.set_value("status", r.message);
+ frm.reload_doc();
+ }
+ }
+ });
}
});
\ No newline at end of file
diff --git a/erpnext/subscription/doctype/subscription/subscription.json b/erpnext/accounts/doctype/subscription/subscription.json
similarity index 94%
rename from erpnext/subscription/doctype/subscription/subscription.json
rename to erpnext/accounts/doctype/subscription/subscription.json
index 6cfee1e44f..85779533ea 100644
--- a/erpnext/subscription/doctype/subscription/subscription.json
+++ b/erpnext/accounts/doctype/subscription/subscription.json
@@ -148,7 +148,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
- "in_list_view": 0,
+ "in_list_view": 1,
"in_standard_filter": 0,
"label": "Disabled",
"length": 0,
@@ -619,24 +619,24 @@
},
{
"allow_bulk_edit": 0,
- "allow_on_submit": 0,
+ "allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Draft",
"fieldname": "status",
"fieldtype": "Select",
- "hidden": 1,
+ "hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
- "in_list_view": 0,
+ "in_list_view": 1,
"in_standard_filter": 0,
"label": "Status",
"length": 0,
"no_copy": 0,
- "options": "\nDraft\nSubmitted\nCancelled\nCompleted",
+ "options": "\nDraft\nStopped\nSubmitted\nCancelled\nCompleted",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -690,9 +690,9 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2017-08-29 15:45:16.157643",
+ "modified": "2017-09-14 12:09:38.471458",
"modified_by": "Administrator",
- "module": "Subscription",
+ "module": "Accounts",
"name": "Subscription",
"name_case": "",
"owner": "Administrator",
@@ -700,7 +700,7 @@
{
"amend": 0,
"apply_user_permissions": 0,
- "cancel": 1,
+ "cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
@@ -716,6 +716,46 @@
"share": 1,
"submit": 1,
"write": 1
+ },
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
+ "cancel": 0,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts User",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 1,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
+ "cancel": 0,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts Manager",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 1,
+ "write": 1
}
],
"quick_entry": 0,
diff --git a/erpnext/subscription/doctype/subscription/subscription.py b/erpnext/accounts/doctype/subscription/subscription.py
similarity index 82%
rename from erpnext/subscription/doctype/subscription/subscription.py
rename to erpnext/accounts/doctype/subscription/subscription.py
index be36211ec2..c9df7d461e 100644
--- a/erpnext/subscription/doctype/subscription/subscription.py
+++ b/erpnext/accounts/doctype/subscription/subscription.py
@@ -71,13 +71,16 @@ class Subscription(Document):
doc.db_set('subscription', self.name)
- def update_status(self):
+ def update_status(self, status=None):
self.status = {
'0': 'Draft',
'1': 'Submitted',
'2': 'Cancelled'
}[cstr(self.docstatus or 0)]
+ if status and status != 'Resumed':
+ self.status = status
+
def get_next_schedule_date(start_date, frequency, repeat_on_day):
mcount = month_map.get(frequency)
if mcount:
@@ -93,11 +96,10 @@ def make_subscription_entry(date=None):
schedule_date = getdate(data.next_schedule_date)
while schedule_date <= getdate(today()):
create_documents(data, schedule_date)
-
schedule_date = get_next_schedule_date(schedule_date,
data.frequency, data.repeat_on_day)
- if schedule_date:
+ if schedule_date and not frappe.db.get_value('Subscription', data.name, 'disabled'):
frappe.db.set_value('Subscription', data.name, 'next_schedule_date', schedule_date)
def get_subscription_entries(date):
@@ -105,23 +107,29 @@ def get_subscription_entries(date):
where docstatus = 1 and next_schedule_date <=%s
and reference_document is not null and reference_document != ''
and next_schedule_date <= ifnull(end_date, '2199-12-31')
- and ifnull(disabled, 0) = 0""", (date), as_dict=1)
+ and ifnull(disabled, 0) = 0 and status != 'Stopped' """, (date), as_dict=1)
def create_documents(data, schedule_date):
try:
doc = make_new_document(data, schedule_date)
- if data.notify_by_email:
- send_notification(doc, data.print_format, data.recipients)
+ if data.notify_by_email and data.recipients:
+ print_format = data.print_format or "Standard"
+ send_notification(doc, print_format, data.recipients)
frappe.db.commit()
except Exception:
frappe.db.rollback()
frappe.db.begin()
frappe.log_error(frappe.get_traceback())
+ disabled_subscription(data)
frappe.db.commit()
if data.reference_document and not frappe.flags.in_test:
notify_error_to_user(data)
+def disabled_subscription(data):
+ subscription = frappe.get_doc('Subscription', data.name)
+ subscription.db_set('disabled', 1)
+
def notify_error_to_user(data):
party = ''
party_type = ''
@@ -134,7 +142,7 @@ def notify_error_to_user(data):
if party_type:
party = frappe.db.get_value(data.reference_doctype, data.reference_document, party_type)
- notify_errors(data.reference_document, data.reference_doctype, party, data.owner)
+ notify_errors(data.reference_document, data.reference_doctype, party, data.owner, data.name)
def make_new_document(args, schedule_date):
doc = frappe.get_doc(args.reference_doctype, args.reference_document)
@@ -168,32 +176,32 @@ def get_next_date(dt, mcount, day=None):
def send_notification(new_rv, print_format='Standard', recipients=None):
"""Notify concerned persons about recurring document generation"""
- recipients = recipients or new_rv.notification_email_address
- print_format = print_format or new_rv.recurring_print_format
+ print_format = print_format
frappe.sendmail(recipients,
subject= _("New {0}: #{1}").format(new_rv.doctype, new_rv.name),
message = _("Please find attached {0} #{1}").format(new_rv.doctype, new_rv.name),
attachments = [frappe.attach_print(new_rv.doctype, new_rv.name, file_name=new_rv.name, print_format=print_format)])
-def notify_errors(doc, doctype, party, owner):
+def notify_errors(doc, doctype, party, owner, name):
recipients = get_system_managers(only_name=True)
frappe.sendmail(recipients + [frappe.db.get_value("User", owner, "email")],
- subject="[Urgent] Error while creating recurring %s for %s" % (doctype, doc),
+ subject=_("[Urgent] Error while creating recurring %s for %s" % (doctype, doc)),
message = frappe.get_template("templates/emails/recurring_document_failed.html").render({
- "type": doctype,
+ "type": _(doctype),
"name": doc,
- "party": party or ""
+ "party": party or "",
+ "subscription": name
}))
- assign_task_to_owner(doc, doctype, "Recurring Invoice Failed", recipients)
+ assign_task_to_owner(name, "Recurring Documents Failed", recipients)
-def assign_task_to_owner(doc, doctype, msg, users):
+def assign_task_to_owner(name, msg, users):
for d in users:
args = {
+ 'doctype' : 'Subscription',
'assign_to' : d,
- 'doctype' : doctype,
- 'name' : doc,
+ 'name' : name,
'description' : msg,
'priority' : 'High'
}
@@ -205,3 +213,16 @@ def make_subscription(doctype, docname):
doc.reference_doctype = doctype
doc.reference_document = docname
return doc
+
+@frappe.whitelist()
+def stop_resume_subscription(subscription, status):
+ doc = frappe.get_doc('Subscription', subscription)
+ frappe.msgprint(_("Subscription has been {0}").format(status))
+ if status == 'Resumed':
+ doc.next_schedule_date = get_next_schedule_date(today(),
+ doc.frequency, doc.repeat_on_day)
+
+ doc.update_status(status)
+ doc.save()
+
+ return doc.status
\ No newline at end of file
diff --git a/erpnext/subscription/doctype/subscription/subscription_list.js b/erpnext/accounts/doctype/subscription/subscription_list.js
similarity index 56%
rename from erpnext/subscription/doctype/subscription/subscription_list.js
rename to erpnext/accounts/doctype/subscription/subscription_list.js
index 6a33638b39..71e3cce79d 100644
--- a/erpnext/subscription/doctype/subscription/subscription_list.js
+++ b/erpnext/accounts/doctype/subscription/subscription_list.js
@@ -1,10 +1,14 @@
frappe.listview_settings['Subscription'] = {
add_fields: ["next_schedule_date"],
get_indicator: function(doc) {
- if(doc.next_schedule_date >= frappe.datetime.get_today() ) {
+ if(doc.disabled) {
+ return [__("Disabled"), "red"];
+ } else if(doc.next_schedule_date >= frappe.datetime.get_today() && doc.status != 'Stopped') {
return [__("Active"), "green"];
} else if(doc.docstatus === 0) {
return [__("Draft"), "red", "docstatus,=,0"];
+ } else if(doc.status === 'Stopped') {
+ return [__("Stopped"), "red"];
} else {
return [__("Expired"), "darkgrey"];
}
diff --git a/erpnext/subscription/doctype/subscription/test_subscription.js b/erpnext/accounts/doctype/subscription/test_subscription.js
similarity index 100%
rename from erpnext/subscription/doctype/subscription/test_subscription.js
rename to erpnext/accounts/doctype/subscription/test_subscription.js
diff --git a/erpnext/subscription/doctype/subscription/test_subscription.py b/erpnext/accounts/doctype/subscription/test_subscription.py
similarity index 97%
rename from erpnext/subscription/doctype/subscription/test_subscription.py
rename to erpnext/accounts/doctype/subscription/test_subscription.py
index 28f8be7257..b74163c92e 100644
--- a/erpnext/subscription/doctype/subscription/test_subscription.py
+++ b/erpnext/accounts/doctype/subscription/test_subscription.py
@@ -10,7 +10,7 @@ from erpnext.accounts.utils import get_fiscal_year
from erpnext.accounts.report.financial_statements import get_months
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
-from erpnext.subscription.doctype.subscription.subscription import make_subscription_entry
+from erpnext.accounts.doctype.subscription.subscription import make_subscription_entry
class TestSubscription(unittest.TestCase):
def test_daily_subscription(self):
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index 6d16e9202e..7c0f540154 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -32,6 +32,12 @@ def get_data():
"label": _("POS"),
"description": _("Point of Sale")
},
+ {
+ "type": "doctype",
+ "name": "Subscription",
+ "label": _("Subscription"),
+ "description": _("To make recurring documents")
+ },
{
"type": "report",
"name": "Accounts Receivable",
diff --git a/erpnext/docs/assets/img/subscription/subscription.gif b/erpnext/docs/assets/img/accounts/subscription.gif
similarity index 100%
rename from erpnext/docs/assets/img/subscription/subscription.gif
rename to erpnext/docs/assets/img/accounts/subscription.gif
diff --git a/erpnext/docs/assets/img/subscription/subscription.png b/erpnext/docs/assets/img/accounts/subscription.png
similarity index 100%
rename from erpnext/docs/assets/img/subscription/subscription.png
rename to erpnext/docs/assets/img/accounts/subscription.png
diff --git a/erpnext/docs/user/manual/en/accounts/index.txt b/erpnext/docs/user/manual/en/accounts/index.txt
index 6a0da3a894..41cb243dc6 100644
--- a/erpnext/docs/user/manual/en/accounts/index.txt
+++ b/erpnext/docs/user/manual/en/accounts/index.txt
@@ -6,6 +6,7 @@ purchase-invoice
payments
journal-entry
payment-entry
+subscription
multi-currency-accounting
advance-payment-entry
payment-request
diff --git a/erpnext/docs/user/manual/en/accounts/subscription.md b/erpnext/docs/user/manual/en/accounts/subscription.md
new file mode 100644
index 0000000000..9afab58e25
--- /dev/null
+++ b/erpnext/docs/user/manual/en/accounts/subscription.md
@@ -0,0 +1,24 @@
+# Subscription
+
+If you have a contract with the Customer where your organization gives bill to the Customer on a monthly, quarterly, half-yearly or annual basis, you can use subscription feature to make auto invoicing.
+
+
+
+#### Scenario
+
+Subscription for your hosted ERPNext account requires yearly renewal. We use Sales Invoice for generating proforma invoices. To automate proforma invoicing for renewal, we set original Sales Invoice on the subscription form. Recurring proforma invoice is created automatically just before customer's account is about to expire, and requires renewal. This recurring Proforma Invoice is also emailed automatically to the customer.
+
+To set the subscription for the sales invoice
+Goto Subscription > select base doctype "Sales Invoice" > select base docname "Invoice No" > Save
+
+
+
+**From Date and To Date**: This defines contract period with the customer.
+
+**Repeat on Day**: If frequency is set as Monthly, then it will be day of the month on which recurring invoice will be generated.
+
+**Notify By Email**: If you want to notify the user about auto recurring invoice.
+
+**Print Format**: Select a print format to define document view which should be emailed to customer.
+
+**Disabled**: It will stop to make auto recurring documents against the subscription
\ No newline at end of file
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 26c7a3aa61..8306290f72 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -192,7 +192,7 @@ doc_events = {
scheduler_events = {
"hourly": [
- "erpnext.subscription.doctype.subscription.subscription.make_subscription_entry",
+ "erpnext.accounts.doctype.subscription.subscription.make_subscription_entry",
'erpnext.hr.doctype.daily_work_summary_settings.daily_work_summary_settings.trigger_emails'
],
"daily": [
diff --git a/erpnext/modules.txt b/erpnext/modules.txt
index 6f4a5b7a59..04344a0abb 100644
--- a/erpnext/modules.txt
+++ b/erpnext/modules.txt
@@ -15,5 +15,4 @@ Portal
Maintenance
Schools
Regional
-Healthcare
-Subscription
\ No newline at end of file
+Healthcare
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 1a082a366f..5d026a62d4 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -439,6 +439,7 @@ erpnext.patches.v8_7.set_offline_in_pos_settings #11-09-17
erpnext.patches.v8_9.add_setup_progress_actions #08-09-2017
erpnext.patches.v8_9.rename_company_sales_target_field
erpnext.patches.v8_8.set_bom_rate_as_per_uom
+erpnext.patches.v9_0.remove_subscription_module
erpnext.patches.v8_7.make_subscription_from_recurring_data
erpnext.patches.v8_9.set_print_zero_amount_taxes
erpnext.patches.v8_9.set_default_customer_group
\ No newline at end of file
diff --git a/erpnext/patches/v8_7/make_subscription_from_recurring_data.py b/erpnext/patches/v8_7/make_subscription_from_recurring_data.py
index 03d8eb4193..89eca1a0ec 100644
--- a/erpnext/patches/v8_7/make_subscription_from_recurring_data.py
+++ b/erpnext/patches/v8_7/make_subscription_from_recurring_data.py
@@ -6,7 +6,7 @@ import frappe
from frappe.utils import today
def execute():
- frappe.reload_doc('subscription', 'doctype', 'subscription')
+ frappe.reload_doc('accounts', 'doctype', 'subscription')
frappe.reload_doc('selling', 'doctype', 'sales_order')
frappe.reload_doc('buying', 'doctype', 'purchase_order')
frappe.reload_doc('accounts', 'doctype', 'sales_invoice')
diff --git a/erpnext/patches/v9_0/__init__.py b/erpnext/patches/v9_0/__init__.py
new file mode 100644
index 0000000000..baffc48825
--- /dev/null
+++ b/erpnext/patches/v9_0/__init__.py
@@ -0,0 +1 @@
+from __future__ import unicode_literals
diff --git a/erpnext/patches/v9_0/remove_subscription_module.py b/erpnext/patches/v9_0/remove_subscription_module.py
new file mode 100644
index 0000000000..493873f3e8
--- /dev/null
+++ b/erpnext/patches/v9_0/remove_subscription_module.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2017, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ if frappe.db.exists('Module Def', 'Subscription'):
+ frappe.db.sql(""" delete from `tabModule Def` where name = 'Subscription'""")
\ No newline at end of file
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 8a47df6371..721f216888 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -129,7 +129,7 @@ $.extend(erpnext.utils, {
make_subscription: function(doctype, docname) {
frappe.call({
- method: "erpnext.subscription.doctype.subscription.subscription.make_subscription",
+ method: "erpnext.accounts.doctype.subscription.subscription.make_subscription",
args: {
doctype: doctype,
docname: docname
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 5f828900d5..8720482549 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -13,7 +13,7 @@ from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty
from frappe.desk.notifications import clear_doctype_notifications
from frappe.contacts.doctype.address.address import get_company_address
from erpnext.controllers.selling_controller import SellingController
-from erpnext.subscription.doctype.subscription.subscription import month_map, get_next_date
+from erpnext.accounts.doctype.subscription.subscription import get_next_schedule_date
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
@@ -347,8 +347,7 @@ class SalesOrder(SellingController):
return items
def on_recurring(self, reference_doc, subscription_doc):
- mcount = month_map[subscription_doc.frequency]
- self.set("delivery_date", get_next_date(reference_doc.delivery_date, mcount,
+ self.set("delivery_date", get_next_schedule_date(reference_doc.delivery_date, subscription_doc.frequency,
cint(subscription_doc.repeat_on_day)))
for d in self.get("items"):
@@ -356,7 +355,7 @@ class SalesOrder(SellingController):
{"parent": reference_doc.name, "item_code": d.item_code, "idx": d.idx}, "delivery_date")
d.set("delivery_date",
- get_next_date(reference_delivery_date, mcount, cint(subscription_doc.repeat_on_day)))
+ get_next_schedule_date(reference_delivery_date, subscription_doc.frequency, cint(subscription_doc.repeat_on_day)))
def get_list_context(context=None):
from erpnext.controllers.website_list_for_contact import get_list_context
diff --git a/erpnext/subscription/__init__.py b/erpnext/subscription/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/subscription/doctype/__init__.py b/erpnext/subscription/doctype/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/subscription/doctype/subscription/__init__.py b/erpnext/subscription/doctype/subscription/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/templates/emails/recurring_document_failed.html b/erpnext/templates/emails/recurring_document_failed.html
index 9b88731178..ea48034f41 100644
--- a/erpnext/templates/emails/recurring_document_failed.html
+++ b/erpnext/templates/emails/recurring_document_failed.html
@@ -1,12 +1,11 @@
-Recurring {{ type }} Failed
+{{_("Recurring")}} {{ type }} {{ _("Failed")}}
An error occured while creating recurring {{ type }} {{ name }} for {{ party }}.
This could be because of some invalid Email Addresses in the {{ type }}.
-To stop sending repetitive error notifications from the system, we have unchecked
-"Convert into Recurring" field in the {{ type }} {{ name }}.
-Please correct the {{ type }} and make the {{ type }} recurring again.
+To stop sending repetitive error notifications from the system, we have checked "Disabled" field in the subscription {{ subscription}} for the {{ type }} {{ name }}.
+Please correct the {{ type }} and unchcked "Disabled" in the {{ subscription }} for making recurring again.
It is necessary to take this action today itself for the above mentioned recurring {{ type }}
to be generated. If delayed, you will have to manually change the "Repeat on Day of Month" field
-of this {{ type }} for generating the recurring {{ type }}.
+of this {{ type }} for generating the recurring {{ type }} in the subscription {{ subscription }}.
[This email is autogenerated]