When record a purchase invoice with the stock item A1001, the Stock On Hand account is debited and the Accounts Payable account is being credited. The Cost of goods sold account will not be updated until item A1001 has sold.
That is, when you create a Sales Invoice for the item A1001, the double entry will be:
Debit Accounts Receivable account
Credit Sales account
Debit Purchase account
Credit Stock On Hand account
The average cost of the item will be debited to the Purchase account (cost of goods sold account) and credit the Stock On Hand account.