fix: ensure defaults removed in bad frappe patch get set again (backport #31659) (#31661)

fix: ensure defaults removed in bad frappe patch get set again (#31659)

(cherry picked from commit bf2833b8ee)

Co-authored-by: Sagar Vora <sagar@resilient.tech>
This commit is contained in:
mergify[bot]
2022-07-21 13:54:55 +05:30
committed by GitHub
parent 794fd0819f
commit 763787b0a5
2 changed files with 30 additions and 0 deletions

View File

@@ -370,3 +370,4 @@ erpnext.patches.v13_0.job_card_status_on_hold
erpnext.patches.v13_0.add_cost_center_in_loans
erpnext.patches.v13_0.show_india_localisation_deprecation_warning
erpnext.patches.v13_0.fix_number_and_frequency_for_monthly_depreciation
erpnext.patches.v13_0.reset_corrupt_defaults

View File

@@ -0,0 +1,29 @@
import frappe
def execute():
"""
This patch is needed to fix parent incorrectly set as `__2fa` because of
https://github.com/frappe/frappe/commit/a822092211533ff17ff9b92dd86f6f868ed63e2e
"""
for doctype in (
"Accounts Settings",
"Stock Settings",
"Selling Settings",
"Buying Settings",
"CRM Settings",
"Global Defaults",
"Healthcare Settings",
"Education Settings",
):
try:
frappe.get_single(doctype).save()
except Exception:
pass
try:
pos_profile = frappe.get_last_doc("POS Profile")
pos_profile.set_defaults()
except Exception:
pass