From 18e5d59d24dc1981c2e2df2facf8517988e621e0 Mon Sep 17 00:00:00 2001 From: Saqib Ansari Date: Sun, 26 Sep 2021 17:39:40 +0530 Subject: [PATCH] fix: unknown column 'ref_exchange_rate' --- .../patches/v13_0/modify_invalid_gain_loss_gl_entries.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/v13_0/modify_invalid_gain_loss_gl_entries.py b/erpnext/patches/v13_0/modify_invalid_gain_loss_gl_entries.py index 4781ccb4b2..81b72cf40f 100644 --- a/erpnext/patches/v13_0/modify_invalid_gain_loss_gl_entries.py +++ b/erpnext/patches/v13_0/modify_invalid_gain_loss_gl_entries.py @@ -4,6 +4,9 @@ import frappe def execute(): + frappe.reload_doc('accounts', 'doctype', 'purchase_invoice_advance') + frappe.reload_doc('accounts', 'doctype', 'sales_invoice_advance') + purchase_invoices = frappe.db.sql(""" select parenttype as type, parent as name @@ -35,6 +38,7 @@ def execute(): doc.docstatus = 2 doc.make_gl_entries() for advance in doc.advances: - advance.db_set('exchange_gain_loss', 0, False) + if advance.ref_exchange_rate == 1: + advance.db_set('exchange_gain_loss', 0, False) doc.docstatus = 1 doc.make_gl_entries() \ No newline at end of file