Merge pull request #6777 from nabinhait/hotfix

[fix] Report GLE for Purchase Invoice with Update Stock option
This commit is contained in:
Nabin Hait 2016-11-01 12:31:51 +05:30 committed by GitHub
commit b8617cfdf9
2 changed files with 6 additions and 2 deletions

View File

@ -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
erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01

View File

@ -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()