refactor: Clean up non-profit setup
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 0b4696c..a44c8fa 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -130,11 +130,3 @@
return fn(*args, **kwargs)
return caller
-
-def get_last_membership(member):
- '''Returns last membership if exists'''
- last_membership = frappe.get_all('Membership', 'name,to_date,membership_type',
- dict(member=member, paid=1), order_by='to_date desc', limit=1)
-
- if last_membership:
- return last_membership[0]
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index a8134f2..7bc7071 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -334,7 +334,6 @@
erpnext.patches.v13_0.delete_bank_reconciliation_detail
erpnext.patches.v13_0.enable_provisional_accounting
erpnext.patches.v13_0.non_profit_deprecation_warning
-erpnext.patches.v14_0.delete_non_profit_doctypes
[post_model_sync]
erpnext.patches.v14_0.rename_ongoing_status_in_sla_documents
@@ -351,3 +350,4 @@
erpnext.patches.v14_0.migrate_cost_center_allocations
erpnext.patches.v13_0.convert_to_website_item_in_item_card_group_template
erpnext.patches.v13_0.shopping_cart_to_ecommerce
+erpnext.patches.v14_0.delete_non_profit_doctypes
diff --git a/erpnext/patches/v14_0/delete_non_profit_doctypes.py b/erpnext/patches/v14_0/delete_non_profit_doctypes.py
index 86355a6..39f2fec 100644
--- a/erpnext/patches/v14_0/delete_non_profit_doctypes.py
+++ b/erpnext/patches/v14_0/delete_non_profit_doctypes.py
@@ -30,10 +30,24 @@
for doctype in doctypes:
frappe.delete_doc("DocType", doctype, ignore_missing=True)
- custom_fields = [
- {"dt": "Member", "fieldname": "pan_number"},
- {"dt": "Donor", "fieldname": "pan_number"},
- ]
- for field in custom_fields:
- custom_field = frappe.db.get_value("Custom Field", field)
- frappe.delete_doc("Custom Field", custom_field, ignore_missing=True)
+ forms = ['grant-application', 'certification-application', 'certification-application-usd']
+ for form in forms:
+ frappe.delete_doc("Web Form", form, ignore_missing=True)
+
+ custom_fields = {
+ 'Member': ['pan_number'],
+ 'Donor': ['pan_number'],
+ 'Company': [
+ 'non_profit_section', 'company_80g_number', 'with_effect_from',
+ 'non_profit_column_break', 'pan_details'
+ ],
+ }
+
+ for doc, fields in custom_fields.items():
+ filters = {
+ 'dt': doc,
+ 'fieldname': ['in', fields]
+ }
+ records = frappe.get_all('Custom Field', filters=filters, pluck='name')
+ for record in records:
+ frappe.delete_doc('Custom Field', record, ignore_missing=True, force=True)
diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py
index c2e8304..8f3ef62 100644
--- a/erpnext/regional/india/setup.py
+++ b/erpnext/regional/india/setup.py
@@ -610,15 +610,6 @@
dict(fieldname='hra_column_break', fieldtype='Column Break', insert_after='hra_component'),
dict(fieldname='arrear_component', label='Arrear Component',
fieldtype='Link', options='Salary Component', insert_after='hra_column_break'),
- dict(fieldname='non_profit_section', label='Non Profit Settings',
- fieldtype='Section Break', insert_after='arrear_component', collapsible=1),
- dict(fieldname='company_80g_number', label='80G Number',
- fieldtype='Data', insert_after='non_profit_section'),
- dict(fieldname='with_effect_from', label='80G With Effect From',
- fieldtype='Date', insert_after='company_80g_number'),
- dict(fieldname='non_profit_column_break', fieldtype='Column Break', insert_after='with_effect_from'),
- dict(fieldname='pan_details', label='PAN Number',
- fieldtype='Data', insert_after='non_profit_column_break')
],
'Employee Tax Exemption Declaration':[
dict(fieldname='hra_section', label='HRA Exemption',