fix: rollback on exception

This commit is contained in:
Saqib Ansari 2021-10-12 13:13:48 +05:30
parent 353ad5f6ff
commit c103f72fad

View File

@ -52,7 +52,9 @@ def execute():
advance.db_set('exchange_gain_loss', 0, False) advance.db_set('exchange_gain_loss', 0, False)
doc.docstatus = 1 doc.docstatus = 1
doc.make_gl_entries() doc.make_gl_entries()
frappe.db.commit()
except Exception: except Exception:
frappe.db.rollback()
print(f'Failed to correct gl entries of {invoice.name}') print(f'Failed to correct gl entries of {invoice.name}')
if acc_frozen_upto: if acc_frozen_upto: