repost gle for Purchase Invoice with update stock

This commit is contained in:
Nabin Hait
2016-11-01 11:25:22 +05:30
parent 9600b29399
commit f7ac1236ed
2 changed files with 6 additions and 2 deletions

View File

@@ -321,4 +321,4 @@ erpnext.patches.v7_0.update_mode_of_payment_type
finally:erpnext.patches.v7_0.update_timesheet_communications
erpnext.patches.v7_0.update_status_of_zero_amount_sales_order
erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty
erpnext.patches.v7_0.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()