From c6359a9179c2c5f49b163b0b9a4fb5762b28b4d1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 23 Dec 2011 18:26:17 +0530 Subject: [PATCH] Patch to update against_voucher in gle for jv aganst jv --- .../update_gle_against_voucher_for_jv.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 erpnext/patches/update_gle_against_voucher_for_jv.py diff --git a/erpnext/patches/update_gle_against_voucher_for_jv.py b/erpnext/patches/update_gle_against_voucher_for_jv.py new file mode 100644 index 00000000000..3da8dec2efb --- /dev/null +++ b/erpnext/patches/update_gle_against_voucher_for_jv.py @@ -0,0 +1,18 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + + # reload jv gl mapper + reload_doc('accounts', 'GL Mapper', 'Journal Voucher') + + # select jv where against_jv exists + jv = webnotes.conn.sql("select distinct parent from `tabJournal Voucher Detail` where docstatus = 1 and ifnull(against_jv, '') != ''") + + for d in jv: + jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children=1) + + # cancel + get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =1, adv_adj = 1) + + #re-submit + get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =0, adv_adj = 1)