From c103f72faddf9b7afd9d58d44703e98c6e687605 Mon Sep 17 00:00:00 2001 From: Saqib Ansari Date: Tue, 12 Oct 2021 13:13:48 +0530 Subject: [PATCH] fix: rollback on exception --- erpnext/patches/v13_0/modify_invalid_gain_loss_gl_entries.py | 2 ++ 1 file changed, 2 insertions(+) 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 ddf70aa814..3af7dac342 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 @@ -52,7 +52,9 @@ def execute(): advance.db_set('exchange_gain_loss', 0, False) doc.docstatus = 1 doc.make_gl_entries() + frappe.db.commit() except Exception: + frappe.db.rollback() print(f'Failed to correct gl entries of {invoice.name}') if acc_frozen_upto: