From 811e51fb50f013492c14a1a0c7f6e8ca3cab0410 Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Tue, 7 Dec 2021 15:21:51 +0530 Subject: [PATCH] fix: reload SI meta before checking --- erpnext/patches/v13_0/rename_ksa_qr_field.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v13_0/rename_ksa_qr_field.py b/erpnext/patches/v13_0/rename_ksa_qr_field.py index 4946b0d1db..0bb86e0450 100644 --- a/erpnext/patches/v13_0/rename_ksa_qr_field.py +++ b/erpnext/patches/v13_0/rename_ksa_qr_field.py @@ -10,5 +10,7 @@ def execute(): if not company: return - if frappe.db.exists('DocType', 'Sales Invoice') and frappe.get_meta('Sales Invoice').has_field('qr_code'): - rename_field('Sales Invoice', 'qr_code', 'ksa_einv_qr') + if frappe.db.exists('DocType', 'Sales Invoice'): + frappe.reload_doc('accounts', 'doctype', 'sales_invoice', force=True) + if frappe.db.has_column('Sales Invoice', 'qr_code'): + rename_field('Sales Invoice', 'qr_code', 'ksa_einv_qr')