fix: reposting patch

This commit is contained in:
Rohit Waghchaure 2021-02-26 17:34:53 +05:30
parent 8faf8e4b25
commit 9f13a060f0
2 changed files with 10 additions and 2 deletions

View File

@ -7,7 +7,7 @@ from erpnext.accounts.utils import update_gl_entries_after
def execute(): def execute():
frappe.reload_doc('stock', 'doctype', 'repost_item_valuation') frappe.reload_doc('stock', 'doctype', 'repost_item_valuation')
reposting_project_deployed_on = frappe.db.get_value("DocType", "Repost Item Valuation", "creation") reposting_project_deployed_on = get_creation_time()
data = frappe.db.sql(''' data = frappe.db.sql('''
SELECT SELECT
@ -48,3 +48,7 @@ def execute():
update_gl_entries_after(posting_date, posting_time, company=row.name) update_gl_entries_after(posting_date, posting_time, company=row.name)
frappe.db.auto_commit_on_many_writes = 0 frappe.db.auto_commit_on_many_writes = 0
def get_creation_time():
return frappe.db.sql(''' SELECT create_time FROM
INFORMATION_SCHEMA.TABLES where TABLE_NAME = "tabRepost Item Valuation" ''', as_list=1)[0][0]

View File

@ -64,6 +64,10 @@ def get_warehouse_account(warehouse, warehouse_account=None):
if not account and warehouse.company: if not account and warehouse.company:
account = get_company_default_inventory_account(warehouse.company) account = get_company_default_inventory_account(warehouse.company)
if not account and warehouse.company:
account = frappe.db.get_value('Account',
{'account_type': 'Stock', 'is_group': 0, 'company': warehouse.company}, 'name')
if not account and warehouse.company and not warehouse.is_group: if not account and warehouse.company and not warehouse.is_group:
frappe.throw(_("Please set Account in Warehouse {0} or Default Inventory Account in Company {1}") frappe.throw(_("Please set Account in Warehouse {0} or Default Inventory Account in Company {1}")
.format(warehouse.name, warehouse.company)) .format(warehouse.name, warehouse.company))