Why sale of inventory also increases purchases in P&L

So I entered my opening balance for all my stock but when i create a sales invoice and i pick inventory on hand it shows in my profit and loss that i have purchased those things even though i had them at the beginning as an opening balance. Whats happening?

This is how inventory accounting works. When you purchase invoice items, they are your assets, not expenses. They become expenses gradually as you sell your inventory items. That’s why selling inventory item will increase your income by sale amount and at the same time increase your expenses by what you have originally purchased the sold item for.

See Inventory and Cost of Goods Sold | Explanation | AccountingCoach

thats fine. another question in my profit and loss i cant see my opening stock and clossing stock. how do i rectify that because for me to get cost of goods sold i need that. or does the system automatically workout everythng?

Manager already does that. Inventory on hand balance on balance sheet represents your closing stock. Purchase of inventory items represents cost of goods sold. Inventory on hand minus Purchases of inventory items is your opening stock.