brotherton-erpnext/erpnext/patches/v6_10/fix_jv_total_amount.py
2015-11-26 09:08:07 +05:30

14 lines
485 B
Python

import frappe
# patch all for-print field (total amount) in Journal Entry in 2015
def execute():
for je in frappe.get_all("Journal Entry", filters={"creation": (">", "2015-01-01")}):
je = frappe.get_doc("Journal Entry", je.name)
original = je.total_amount
je.set_print_format_fields()
if je.total_amount != original:
je.db_set("total_amount", je.total_amount, update_modified=False)
je.db_set("total_amount_in_words", je.total_amount_in_words, update_modified=False)