feat: Enhancement in subscription (#22263)
* feat: Add supplier in subscription doctype * fix: Code cleanup * fix: Add dynamic link in subscription invoices * fix: Multiple enhanccement in subscription * feat: Follow calendar months in subscription * fix: Test Cases and patch * fix: Patch * fix: Update patch and add fixes * fix: Update permission for subscription settings * fix: Patch and Test * fix: Add cost center dimension in Subscripiton
This commit is contained in:
41
erpnext/patches/v13_0/update_subscription.py
Normal file
41
erpnext/patches/v13_0/update_subscription.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2019, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from six import iteritems
|
||||
|
||||
def execute():
|
||||
|
||||
frappe.reload_doc('accounts', 'doctype', 'subscription')
|
||||
frappe.reload_doc('accounts', 'doctype', 'subscription_invoice')
|
||||
frappe.reload_doc('accounts', 'doctype', 'subscription_plan')
|
||||
|
||||
if frappe.db.has_column('Subscription', 'customer'):
|
||||
frappe.db.sql("""
|
||||
UPDATE `tabSubscription`
|
||||
SET
|
||||
start_date = start,
|
||||
party_type = 'Customer',
|
||||
party = customer,
|
||||
sales_tax_template = tax_template
|
||||
WHERE IFNULL(party,'') = ''
|
||||
""")
|
||||
|
||||
frappe.db.sql("""
|
||||
UPDATE `tabSubscription Invoice`
|
||||
SET document_type = 'Sales Invoice'
|
||||
WHERE IFNULL(document_type, '') = ''
|
||||
""")
|
||||
|
||||
price_determination_map = {
|
||||
'Fixed rate': 'Fixed Rate',
|
||||
'Based on price list': 'Based On Price List'
|
||||
}
|
||||
|
||||
for key, value in iteritems(price_determination_map):
|
||||
frappe.db.sql("""
|
||||
UPDATE `tabSubscription Plan`
|
||||
SET price_determination = %s
|
||||
WHERE price_determination = %s
|
||||
""", (value, key))
|
||||
Reference in New Issue
Block a user