fix: reposting patch fixes (#24775)

This commit is contained in:
Nabin Hait
2021-03-02 13:37:45 +05:30
committed by GitHub
parent f45756d821
commit bd10d7c028
2 changed files with 16 additions and 5 deletions

View File

@@ -1,13 +1,24 @@
import frappe
from frappe import _
from frappe.utils import getdate, get_time
from frappe.utils import getdate, get_time, today
from erpnext.stock.stock_ledger import update_entries_after
from erpnext.accounts.utils import update_gl_entries_after
def execute():
frappe.reload_doc('stock', 'doctype', 'repost_item_valuation')
for doctype in ('repost_item_valuation', 'stock_entry_detail', 'purchase_receipt_item',
'purchase_invoice_item', 'delivery_note_item', 'sales_invoice_item', 'packed_item'):
frappe.reload_doc('stock', 'doctype', doctype)
frappe.reload_doc('buying', 'doctype', 'purchase_receipt_item_supplied')
reposting_project_deployed_on = get_creation_time()
posting_date = getdate(reposting_project_deployed_on)
posting_time = get_time(reposting_project_deployed_on)
if posting_date == today():
return
frappe.clear_cache()
frappe.flags.warehouse_account_map = {}
data = frappe.db.sql('''
SELECT
@@ -41,8 +52,6 @@ def execute():
print("Reposting General Ledger Entries...")
posting_date = getdate(reposting_project_deployed_on)
posting_time = get_time(reposting_project_deployed_on)
for row in frappe.get_all('Company', filters= {'enable_perpetual_inventory': 1}):
update_gl_entries_after(posting_date, posting_time, company=row.name)