From 3e97492da49a4e51e93db58a81b6ecdf48d61220 Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Wed, 8 Dec 2021 08:03:30 +0530 Subject: [PATCH] fix: replace frappe.get_all --- erpnext/regional/saudi_arabia/utils.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/regional/saudi_arabia/utils.py b/erpnext/regional/saudi_arabia/utils.py index c712809cf5..a03c3f0994 100644 --- a/erpnext/regional/saudi_arabia/utils.py +++ b/erpnext/regional/saudi_arabia/utils.py @@ -141,10 +141,9 @@ def delete_qr_code_file(doc, method=None): if len(file_doc): frappe.delete_doc('File', file_doc[0].name) -def delete_vat_settings_for_company(doc, method): +def delete_vat_settings_for_company(doc, method=None): if doc.country != 'Saudi Arabia': return - settings_doc = frappe.get_all('KSA VAT Setting', filters={'company': doc.name}, pluck='name') - for settings in settings_doc: - frappe.delete_doc('KSA VAT Setting', settings) + if frappe.db.exists('KSA VAT Setting', doc.name): + frappe.delete_doc('KSA VAT Setting', doc.name)