brotherton-erpnext/erpnext/patches/v6_10/fix_jv_total_amount.py

15 lines
525 B
Python
Raw Normal View History

from __future__ import unicode_literals
2015-11-25 12:21:00 +00:00
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)