refactor: Clean up non-profit setup

This commit is contained in:
ChillarAnand 2022-02-17 08:33:55 +05:30
parent 72fe559031
commit b5ff9b27bd
4 changed files with 22 additions and 25 deletions

View File

@ -130,11 +130,3 @@ def allow_regional(fn):
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]

View File

@ -334,7 +334,6 @@ erpnext.patches.v13_0.update_asset_quantity_field
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.v12_0.add_company_link_to_einvoice_settings
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

View File

@ -30,10 +30,24 @@ def execute():
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)

View File

@ -610,15 +610,6 @@ def get_custom_fields():
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',