ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

alidationError: Loan Account and Payment Account cannot be same

dear all
i download erpnext v13 on ubuntu 20.04 and when restore buckup from erpnext v12
and has been restored after bench migrate i have this error

a@ubuntu:/home/frappe/frappe-bench$ sudo bench migrate
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: pip install frappe-bench

Migrating site1.local
Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘doctype_action’, force=True) #2019-09-23 in site1.local (_1bd3e0294da19198)
Success: Done in 0.251s
Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘doctype_link’, force=True) #2020-10-17 in site1.local (_1bd3e0294da19198)
Success: Done in 0.184s
Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘module_def’) #2020-08-28 in site1.local (_1bd3e0294da19198)
Success: Done in 0.243s
Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘has_role’) in site1.local (_1bd3e0294da19198)
Success: Done in 0.022s
Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘server_script’) in site1.local (_1bd3e0294da19198)
Success: Done in 0.252s
Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘report_column’) in site1.local (_1bd3e0294da19198)
Success: Done in 0.229s
Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘report_filter’) in site1.local (_1bd3e0294da19198)
Success: Done in 0.201s
Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘report’) #2020-08-25 in site1.local (_1bd3e0294da19198)
Success: Done in 0.324s
Executing frappe.patches.v10_0.reload_countries_and_currencies # 14-10-2020 in site1.local (_1bd3e0294da19198)
Updating country info : [====================] 100%
Success: Done in 0.427s
Executing frappe.patches.v12_0.change_existing_dashboard_chart_filters in site1.local (_1bd3e0294da19198)
Success: Done in 0.101s
Executing execute:frappe.delete_doc(“Test Runner”) in site1.local (_1bd3e0294da19198)
Success: Done in 0.016s
Executing execute:frappe.db.set_default(‘desktop:home_page’, ‘workspace’) in site1.local (_1bd3e0294da19198)
Success: Done in 0.13s
Executing frappe.patches.v13_0.website_theme_custom_scss in site1.local (_1bd3e0294da19198)
Success: Done in 3.488s
Executing frappe.patches.v13_0.set_existing_dashboard_charts_as_public in site1.local (_1bd3e0294da19198)
Success: Done in 0.51s
Executing frappe.patches.v13_0.set_path_for_homepage_in_web_page_view in site1.local (_1bd3e0294da19198)
Success: Done in 0.234s
Executing frappe.patches.v13_0.migrate_translation_column_data in site1.local (_1bd3e0294da19198)
Success: Done in 0.268s
Executing frappe.patches.v13_0.set_read_times in site1.local (_1bd3e0294da19198)
Success: Done in 0.344s
Executing frappe.patches.v13_0.remove_web_view in site1.local (_1bd3e0294da19198)
Success: Done in 0.031s
Executing frappe.patches.v13_0.site_wise_logging in site1.local (_1bd3e0294da19198)
Success: Done in 0.022s
Executing frappe.patches.v13_0.set_unique_for_page_view in site1.local (_1bd3e0294da19198)
Success: Done in 0.269s
Executing frappe.patches.v13_0.remove_tailwind_from_page_builder in site1.local (_1bd3e0294da19198)
Success: Done in 0.213s
Executing frappe.patches.v13_0.rename_onboarding in site1.local (_1bd3e0294da19198)
Success: Done in 0.023s
Executing frappe.patches.v13_0.email_unsubscribe in site1.local (_1bd3e0294da19198)
Success: Done in 0.09s
Executing execute:frappe.delete_doc(“Web Template”, “Section with Left Image”, force=1) in site1.local (_1bd3e0294da19198)
Success: Done in 0.024s
Executing execute:frappe.delete_doc(“DocType”, “Onboarding Slide”) in site1.local (_1bd3e0294da19198)
Success: Done in 0.021s
Executing execute:frappe.delete_doc(“DocType”, “Onboarding Slide Field”) in site1.local (_1bd3e0294da19198)
Success: Done in 0.018s
Executing execute:frappe.delete_doc(“DocType”, “Onboarding Slide Help Link”) in site1.local (_1bd3e0294da19198)
Success: Done in 0.037s
Executing frappe.patches.v13_0.update_date_filters_in_user_settings in site1.local (_1bd3e0294da19198)
Success: Done in 0.08s
Executing frappe.patches.v13_0.update_duration_options in site1.local (_1bd3e0294da19198)
Success: Done in 1.095s
Executing frappe.patches.v13_0.replace_old_data_import # 2020-06-24 in site1.local (_1bd3e0294da19198)
Success: Done in 0.09s
Executing frappe.patches.v13_0.create_custom_dashboards_cards_and_charts in site1.local (_1bd3e0294da19198)
Success: Done in 0.062s
Executing frappe.patches.v13_0.rename_is_custom_field_in_dashboard_chart in site1.local (_1bd3e0294da19198)
Success: Done in 0.067s
Executing frappe.patches.v13_0.add_standard_navbar_items in site1.local (_1bd3e0294da19198)
Success: Done in 0.467s
Executing frappe.patches.v13_0.generate_theme_files_in_public_folder in site1.local (_1bd3e0294da19198)
Success: Done in 3.152s
Executing frappe.patches.v13_0.increase_password_length in site1.local (_1bd3e0294da19198)
Success: Done in 0.09s
Executing frappe.patches.v13_0.add_toggle_width_in_navbar_settings in site1.local (_1bd3e0294da19198)
Success: Done in 0.033s
Executing frappe.patches.v13_0.rename_notification_fields in site1.local (_1bd3e0294da19198)
Success: Done in 0.742s
Executing frappe.patches.v13_0.remove_duplicate_navbar_items in site1.local (_1bd3e0294da19198)
Success: Done in 0.032s
Executing frappe.patches.v12_0.set_default_password_reset_limit in site1.local (_1bd3e0294da19198)
Success: Done in 0.574s
Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘doctype’, force=True) in site1.local (_1bd3e0294da19198)
Success: Done in 0.635s
Executing frappe.patches.v13_0.set_route_for_blog_category in site1.local (_1bd3e0294da19198)
Success: Done in 1.008s
Executing frappe.patches.v13_0.enable_custom_script in site1.local (_1bd3e0294da19198)
Success: Done in 0.26s
Executing frappe.patches.v13_0.update_newsletter_content_type in site1.local (_1bd3e0294da19198)
Success: Done in 0.33s
Executing execute:frappe.db.set_value(‘Website Settings’, ‘Website Settings’, {‘navbar_template’: ‘Standard Navbar’, ‘footer_template’: ‘Standard Footer’}) in site1.local (_1bd3e0294da19198)
Success: Done in 0.048s
Executing frappe.patches.v13_0.delete_event_producer_and_consumer_keys in site1.local (_1bd3e0294da19198)
Success: Done in 0.023s
Executing frappe.patches.v13_0.web_template_set_module #2020-10-05 in site1.local (_1bd3e0294da19198)
Success: Done in 0.424s
Executing frappe.patches.v13_0.remove_custom_link in site1.local (_1bd3e0294da19198)
Success: Done in 0.061s
Executing execute:frappe.delete_doc(“DocType”, “Footer Item”) in site1.local (_1bd3e0294da19198)
Success: Done in 0.25s
Executing frappe.patches.v13_0.replace_field_target_with_open_in_new_tab in site1.local (_1bd3e0294da19198)
Success: Done in 0.268s
Executing frappe.patches.v13_0.delete_package_publish_tool in site1.local (_1bd3e0294da19198)
Success: Done in 0.025s
Executing erpnext.patches.v12_0.update_is_cancelled_field in site1.local (_1bd3e0294da19198)
Success: Done in 20.037s
Executing execute:frappe.reload_doc(“accounts”, “doctype”, “POS Payment Method”) #2020-05-28 in site1.local (_1bd3e0294da19198)
Success: Done in 0.206s
Executing execute:frappe.reload_doc(“HR”, “doctype”, “HR Settings”) #2020-01-16 #2020-07-24 in site1.local (_1bd3e0294da19198)
Success: Done in 0.302s
Executing execute:frappe.reload_doc(“Payroll”, “doctype”, “salary_slip”) in site1.local (_1bd3e0294da19198)
Success: Done in 0.777s
Executing execute:frappe.delete_doc_if_exists(“Report”, “Loan Repayment”) in site1.local (_1bd3e0294da19198)
Success: Done in 2.129s
Executing erpnext.patches.v12_0.set_automatically_process_deferred_accounting_in_accounts_settings in site1.local (_1bd3e0294da19198)
Success: Done in 0.34s
Executing erpnext.patches.v12_0.set_production_capacity_in_workstation in site1.local (_1bd3e0294da19198)
Success: Done in 0.349s
Executing erpnext.patches.v12_0.set_employee_preferred_emails in site1.local (_1bd3e0294da19198)
Success: Done in 0.148s
Executing erpnext.patches.v12_0.set_against_blanket_order_in_sales_and_purchase_order in site1.local (_1bd3e0294da19198)
Success: Done in 1.713s
Executing erpnext.patches.v12_0.set_cost_center_in_child_table_of_expense_claim in site1.local (_1bd3e0294da19198)
Success: Done in 0.315s
Executing erpnext.patches.v12_0.add_eway_bill_in_delivery_note in site1.local (_1bd3e0294da19198)
Success: Done in 0.124s
Executing erpnext.patches.v12_0.set_lead_title_field in site1.local (_1bd3e0294da19198)
Success: Done in 0.528s
Executing erpnext.patches.v12_0.set_published_in_hub_tracked_item in site1.local (_1bd3e0294da19198)
Success: Done in 0.241s
Executing erpnext.patches.v12_0.set_job_offer_applicant_email in site1.local (_1bd3e0294da19198)
Success: Done in 0.031s
Executing erpnext.patches.v12_0.move_bank_account_swift_number_to_bank in site1.local (_1bd3e0294da19198)
Success: Done in 1.078s
Executing erpnext.patches.v12_0.rename_bank_reconciliation in site1.local (_1bd3e0294da19198)
Success: Done in 0.092s
Executing erpnext.patches.v12_0.rename_account_type_doctype in site1.local (_1bd3e0294da19198)
Success: Done in 1.835s
Executing erpnext.patches.v12_0.update_healthcare_refactored_changes in site1.local (_1bd3e0294da19198)
Success: Done in 4.158s
Executing erpnext.patches.v12_0.set_total_batch_quantity in site1.local (_1bd3e0294da19198)
Success: Done in 0.351s
Executing erpnext.patches.v12_0.set_default_payroll_based_on in site1.local (_1bd3e0294da19198)
Success: Done in 0.025s
Executing erpnext.patches.v12_0.fix_quotation_expired_status in site1.local (_1bd3e0294da19198)
Success: Done in 0.019s
Executing erpnext.patches.v12_0.update_appointment_reminder_scheduler_entry in site1.local (_1bd3e0294da19198)
Success: Done in 0.023s
Executing erpnext.patches.v12_0.rename_pos_closing_doctype in site1.local (_1bd3e0294da19198)
Success: Done in 2.309s
Executing erpnext.patches.v13_0.replace_pos_payment_mode_table in site1.local (_1bd3e0294da19198)
Success: Done in 0.115s
Executing erpnext.patches.v13_0.patch_to_fix_reverse_linking_in_additional_salary_encashment_and_incentive in site1.local (_1bd3e0294da19198)
Success: Done in 1.201s
Executing execute:frappe.rename_doc(“Desk Page”, “Getting Started”, “Home”, force=True) in site1.local (_1bd3e0294da19198)
Success: Done in 0.022s
Executing erpnext.patches.v12_0.set_valid_till_date_in_supplier_quotation in site1.local (_1bd3e0294da19198)
Success: Done in 0.638s
Executing erpnext.patches.v13_0.update_old_loans in site1.local (_1bd3e0294da19198)
Traceback (most recent call last):
File “/usr/lib/python3.8/runpy.py”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.8/runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 99, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 26, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 293, in migrate
migrate(
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 67, in migrate
frappe.modules.patch_handler.run_all(skip_failing)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 41, in run_all
run_patch(patch)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 30, in run_patch
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 71, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 91, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v13_0/update_old_loans.py”, line 85, in execute
loan_type_doc.submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 918, in submit
self._submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 907, in _submit
self.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 285, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 320, in save
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 953, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 848, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1135, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1118, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 842, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/loan_management/doctype/loan_type/loan_type.py”, line 12, in validate
self.validate_accounts()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/loan_management/doctype/loan_type/loan_type.py”, line 23, in validate_accounts
frappe.throw(
(‘Loan Account and Payment Account cannot be same’))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 411, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable, wide=wide, as_list=as_list)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 390, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 344, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Loan Account and Payment Account cannot be same

Hello Sheashaa,

Did you get any solution for the same issue?
I am facing the exact problem.

This is due to the same account used in Loan Module (Loan Account & Payment Account).

I guess the only solution would be to cancel all entries.

Let me know if you have any solution.

@nabinhait

Can you please advise any workaround?
That would save a lot of time.

Your feedback will be highly appreciated.

Regards,

Sadiq Mohamed

Hello Sadiq, we are also facing same issue , we are upgrading from v12 to v13 , and got same issue.

You got any solutions ?

no solutions

Is there any solution for this issue I cant upgrade to version 13 without having a fix for this

There is no solution to this. It’s actually not a bug but the way Loan Management has been refactored. The only way to fix this is to cancel all existing loans and re-process them if you’ve already moved to V13 or wait until all existing loans are liquidated before you migrate.

It took me several months and multiple cancellations of several records including payslips, journals loan applications to get my instance to comply with the changes in V13. I guess they did not consider the ramification of these changes before they implemented or could not be bothered about the effect of the changes. Either way you won’t get any support or response to this issue as it’s been on for well over a year since v13 was in beta 10.

3 Likes