Warehouse Stock account link error

Hi Im quite new to setting up stock in erp and hoping that some one can help me with this problem.
I am getting the below error when trying to submit a material receipt or material issue.
Warehouse - is not linked to any account, please create/link the corresponding (Asset) account for the warehouse.
I didn’t have a problem entering stock into the warehouse last week and im not sure if i have changed something by mistake which is stopping me from submitting these now?
Any help would be great Thanks!

Did you refer the manual for setting up stock?
Manual: https://frappe.github.io/erpnext/user/manual/en/stock/

Hello,
Please check if there is an parent account linked to the warehouse in Chart of accounts.

Hope this helps.

@Rosie07 You are getting this error because there is no account associated with the warehouse . Until last week, we were allowing the entry though accounting entry was not made for those transactions. The system was giving an message saying “Accounting entry was not made”, but allowing to submit the transaction. This is actually wrong, but we were allowing this because of some legacy data. Now we have blocked it.

To proceed, create an account head with account type “Stock” and link warehouse to it. Then create the transaction against the warehouse. And to rectify the current Stock-in-hand balance for the warehouse, make adjustment entry using Journal Entry. Or if there are only few transactions against the warehouse, you can manually amend those transactions.

1 Like

All, the problem here I think is the Warehouse has been renamed as it had a typo in it.

It cannot now be changed:

How can this be fixed as the Accounts setup for Apparel Dynamics - MI is correct:

Thanks.

Fixed the issue in your account

1 Like

Thanks Nabin & team :slight_smile:

Kindly plz provide the steps for it i will be very help full for us

You can use following script to correct the linking and to repost all the stock transactions for that warehouse. Note, it will repost accounting entries for all the stock transactions for the warehouse, even if the entry is made on the closed fiscal year. You can run this script from bench console.

import frappe

def repost():
	warehouse_name = ""
	account_name = ""	

	frappe.db.sql("update `tabAccount` set warehouse=%s where name = %s", (warehouse_name, account_name))

	vouchers = frappe.db.sql("""select distinct voucher_type, voucher_no
		from `tabStock Ledger Entry` sle
		where voucher_type != "Serial No" and sle.warehouse = %s
		order by posting_date, posting_time, name""", warehouse_name)

	rejected = []
	i = 0
	for voucher_type, voucher_no in vouchers:
		i+=1
		print i, "/", len(vouchers), voucher_type, voucher_no
		try:
			frappe.db.sql("""delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s""",
				(voucher_type, voucher_no))

			doc = frappe.get_doc(voucher_type, voucher_no)
			if voucher_type=="Stock Entry" and doc.purpose in ["Manufacture", "Repack"]:
				doc.calculate_rate_and_amount(force=1)
			elif voucher_type=="Purchase Receipt" and doc.is_subcontracted == "Yes":
				doc.validate()

			doc.make_gl_entries(repost_future_gle=False)
			frappe.db.commit()
		except Exception, e:
			print frappe.get_traceback()
			rejected.append([voucher_type, voucher_no])
			frappe.db.rollback()
		
	if rejected:
		print rejected
		
repost()
1 Like

Unfortunately, still need your help to execute bench console

You can start the console using the command bench --site <site_name> console from frappe-bench directory.

i am using virtual machine so not aware of site name? Sorry for my ignorance or level

Default site name is site1.local, verify it from frappe-bench/sites directory.

Can you clarify this bench command? I have a warehouse called “Vendor Managed Inventory” It was the “stores” acocunt which I renamed since I don’t have stores. I am not able to transfer the stock to my main warehouse called “San Francisco”. Can you please clarify the proper way to paste this into the the bench console so that it transfers all stock from “Vendor Managed Inventory” to “San Francisco” warehouses?

Thanks!

I have the same problem I don’t know how to fix it…I was rename some of my account but I didn’t change any warehouse accounting setting will still have the same issue?

Has anyone had any luck in documenting this correct fix for locked up warehouse after a name change? It appears that several people have renamed some of the warehouse names and upon doing so, lose the ability to post transactions to/from it.

I have some assets in a warehouse which are still sitting there even though we have dummy shipped them. Would like to be able to see a documented fix to this.

Nabinhait was kind enough to share a script to fix this, but the documentation is not clear and it seems too risky to attempt without proper clear instructions.