Loan Management ERPnext V15 Not Install

Loan Management ERPnext V15 Not Install

App erpnext already installed

Installing lending…

Running post-install patches to patch existing data…

An error occurred while installing lending: (1146, “Table ‘_8914d7b5151b9b88.tabLoan’ doesn’t exist”)
Traceback with variables (most recent call last):
File “apps/frappe/frappe/commands/site.py”, line 446, in install_app
_install_app(app, verbose=context.verbose, force=force)
context = {‘sites’: [‘lone.ionicerp.xyz’], ‘force’: False, ‘verbose’: False, ‘profile’: False}
apps = (‘lending’,)
force = False
_install_app = <function install_app at 0x7fc444d7b560>
filelock = <function filelock at 0x7fc444d799e0>
exit_code = 0
site = ‘lone.ionicerp.xyz’
app = ‘lending’
err = ProgrammingError(1146, “Table ‘_8914d7b5151b9b88.tabLoan’ doesn’t exist”)
File “apps/frappe/frappe/installer.py”, line 309, in install_app
frappe.get_attr(after_install)()
name = ‘lending’
verbose = False
set_as_patched = True
force = False
sync_jobs = <function sync_jobs at 0x7fc4439d4e00>
sync_for = <function sync_for at 0x7fc4439d5c60>
sync_customizations = <function sync_customizations at 0x7fc444e55ee0>
sync_fixtures = <function sync_fixtures at 0x7fc4439d5f80>
app_hooks = {‘after_install’: [‘lending.install.after_install’], ‘app_description’: [‘Open Source Lending software’], ‘app_email’: [‘contact@frappe.io’], ‘app_include_js’: [‘lending.bundle.js’], ‘app_license’: [‘GNU General Public License (v3)’], ‘app_name’: [‘lending’], ‘app_publisher’: [‘Frappe Technologies Pvt. Ltd.’], ‘app_title’: [‘Frappe Lending’], ‘audit_trail_doctypes’: [‘Loan Balance Adjustment’, ‘Loan Disbursement’, ‘Loan Interest Accrual’, ‘Loan Refund’, ‘Loan Repayment’, ‘Loan Write Off’], ‘bank_reconciliation_doctypes’: [‘Loan Repayment’, ‘Loan Disbursement’], ‘before_tests’: [‘lending.utils.before_tests’], ‘doc_events’: {‘Company’: {‘validate’: [‘lending.overrides.company.validate_loan_tables’]}}, ‘get_amounts_not_reflected_in_system_for_bank_reconciliation_statement’: [‘lending.loan_management.utils.get_amounts_not_reflected_in_system_for_bank_reconciliation_statement’], ‘get_entries_for_bank_clearance_summary’: [‘lending.loan_management.utils.get_entries_for_bank_clearance_summary’…
installed_apps = [‘frappe’, ‘erpnext’, ‘hrms’, ‘payments’, ‘ecommerce_integrations’, ‘chat’, ‘webshop’]
app = ‘erpnext’
required_app = ‘erpnext’
after_install = ‘lending.install.after_install’
File “apps/lending/lending/install.py”, line 236, in after_install
run_patches(get_post_install_patches())
File “apps/lending/lending/install.py”, line 227, in run_patches
frappe.get_attr(f"lending.patches.v15_0.{patch}.execute")()
patches = (‘rename_loan_type_to_loan_product’, ‘generate_loan_repayment_schedule’, ‘update_loan_types’, ‘make_loan_type_non_submittable’, ‘migrate_loan_type_to_loan_product’, ‘add_loan_product_code_and_rename_loan_name’, ‘update_penalty_interest_method_in_loan_products’)
patch = ‘generate_loan_repayment_schedule’
File “apps/lending/lending/patches/v15_0/generate_loan_repayment_schedule.py”, line 8, in execute
loans_created = frappe.db.count(“Loan”)
File “apps/frappe/frappe/database/database.py”, line 1134, in count
).run(debug=debug)[0][0]
self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7fc44454e710>
dt = ‘Loan’
filters = None
debug = False
cache = False
distinct = True
File “apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, args, **kwargs) # nosemgrep
query = 'SELECT DISTINCT COUNT(
) FROM tabLoan
args = ()
kwargs = {‘debug’: False}
child_queries =
params = {}
execute_child_queries = <function patch_query_execute..execute_child_queries at 0x7fc444d80a40>
prepare_query = <function patch_query_execute..prepare_query at 0x7fc443a1c220>
File “apps/frappe/frappe/database/database.py”, line 234, in sql
self._cursor.execute(query, values)
self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7fc44454e710>
query = ‘SELECT DISTINCT COUNT() FROM tabLoan
values = {}
as_dict = 0
as_list = 0
debug = False
ignore_ddl = 0
auto_commit = 0
update = None
explain = False
run = True
pluck = False
as_iterator = False
trace_id = None
File “env/lib/python3.11/site-packages/pymysql/cursors.py”, line 153, in execute
result = self._query(query)
self = <pymysql.cursors.Cursor object at 0x7fc442857f10>
query = 'SELECT DISTINCT COUNT(
) FROM tabLoan
args = {}
File “env/lib/python3.11/site-packages/pymysql/cursors.py”, line 322, in _query
conn.query(q)
self = <pymysql.cursors.Cursor object at 0x7fc442857f10>
q = ‘SELECT DISTINCT COUNT() FROM tabLoan
conn = <pymysql.connections.Connection object at 0x7fc44283c490>
File “env/lib/python3.11/site-packages/pymysql/connections.py”, line 558, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
self = <pymysql.connections.Connection object at 0x7fc44283c490>
sql = b’SELECT DISTINCT COUNT(
) FROM tabLoan
unbuffered = False
File “env/lib/python3.11/site-packages/pymysql/connections.py”, line 822, in _read_query_result
result.read()
self = <pymysql.connections.Connection object at 0x7fc44283c490>
unbuffered = False
result = <pymysql.connections.MySQLResult object at 0x7fc44128ad50>
File “env/lib/python3.11/site-packages/pymysql/connections.py”, line 1200, in read
first_packet = self.connection._read_packet()
self = <pymysql.connections.MySQLResult object at 0x7fc44128ad50>
File “env/lib/python3.11/site-packages/pymysql/connections.py”, line 772, in _read_packet
packet.raise_for_error()
self = <pymysql.connections.Connection object at 0x7fc44283c490>
packet_type = <class ‘pymysql.protocol.MysqlPacket’>
buff = bytearray(b"\xffz\x04#42S02Table '_8914d7b5151b9b88.tabLoan' doesn't exist")
packet_header = b’8\x00\x00\x01’
btrl = 56
btrh = 0
packet_number = 1
bytes_to_read = 56
recv_data = b"\xffz\x04#42S02Table ‘_8914d7b5151b9b88.tabLoan’ doesn’t exist"
packet = <pymysql.protocol.MysqlPacket object at 0x7fc4412b9870>
File “env/lib/python3.11/site-packages/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
self = <pymysql.protocol.MysqlPacket object at 0x7fc4412b9870>
errno = 1146
File “env/lib/python3.11/site-packages/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
data = b"\xffz\x04#42S02Table ‘_8914d7b5151b9b88.tabLoan’ doesn’t exist"
errno = 1146
errval = “Table ‘_8914d7b5151b9b88.tabLoan’ doesn’t exist”
errorclass = <class ‘pymysql.err.ProgrammingError’>
pymysql.err.ProgrammingError: (1146, “Table ‘_8914d7b5151b9b88.tabLoan’ doesn’t exist”)

I got the same problem. but i ended up do the fresh reinstall. it is good if any workaround for this. i spent days to figure out. but i suspect it was the metadata saved somewhere in the system. even though i delete the key in redis, it still there. i gave up in the end…

loan creates new tables in the database so you have to apply these new changes using:

bench migrate

this solved the problem for me