From c61892501c7cf9dadcf9959b9e36701ac7b10444 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 1 Nov 2016 11:45:09 +0530 Subject: [PATCH] [fix] Report GLE for Purchase Invoice with Update Stock option --- erpnext/patches.txt | 2 +- .../{v7_1 => v7_0}/repost_gle_for_pi_with_update_stock.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) rename erpnext/patches/{v7_1 => v7_0}/repost_gle_for_pi_with_update_stock.py (74%) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index d694ef4e8e..0c75d1553e 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -342,4 +342,4 @@ erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty erpnext.patches.v7_1.set_prefered_contact_email execute:frappe.db.sql("update `tabSingles` set value = 1 where field = 'unlink_payment_on_cancellation_of_invoice' and doctype = 'Accounts Settings'") execute:frappe.db.sql("update `tabStock Entry` set total_amount = null where purpose in('Repack', 'Manufacture')") -erpnext.patches.v7_1.repost_gle_for_pi_with_update_stock \ No newline at end of file +erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01 \ No newline at end of file diff --git a/erpnext/patches/v7_1/repost_gle_for_pi_with_update_stock.py b/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py similarity index 74% rename from erpnext/patches/v7_1/repost_gle_for_pi_with_update_stock.py rename to erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py index 2355d539ae..2883a8adc3 100644 --- a/erpnext/patches/v7_1/repost_gle_for_pi_with_update_stock.py +++ b/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py @@ -11,6 +11,10 @@ def execute(): for pi in frappe.db.sql("""select name from `tabPurchase Invoice` where update_stock=1 and docstatus=1 order by posting_date asc""", as_dict=1): + + frappe.db.sql("""delete from `tabGL Entry` + where voucher_type = 'Purchase Invoice' and voucher_no = %s""", pi.name) + pi_doc = frappe.get_doc("Purchase Invoice", pi.name) - pi_doc.make_gl_entries() + pi_doc.make_gl_entries(repost_future_gle=False) frappe.db.commit() \ No newline at end of file