fix: changed logic

This commit is contained in:
Rohit Waghchaure 2021-03-27 19:02:07 +05:30
parent b9aa775f3b
commit 1db8c51749

View File

@ -20,7 +20,7 @@ def execute():
frappe.clear_cache()
frappe.flags.warehouse_account_map = {}
company_wise_data = {}
company_list = []
data = frappe.db.sql('''
SELECT
@ -38,8 +38,8 @@ def execute():
total_sle = len(data)
i = 0
for d in data:
if d.company not in company_wise_data:
company_wise_data[d.company] = True
if d.company not in company_list:
company_list.append(d.company)
update_entries_after({
"item_code": d.item_code,
@ -60,7 +60,7 @@ def execute():
if data:
for row in frappe.get_all('Company', filters= {'enable_perpetual_inventory': 1}):
if company_wise_data.get(row.name):
if row.name in company_list:
update_gl_entries_after(posting_date, posting_time, company=row.name)
frappe.db.auto_commit_on_many_writes = 0