what affects the average cost is new stock purchases
if you have a 1000 widgets at an avco of 1$ each, then this is fine - until you buy some more
if you buy another 500 at £1.20 each then your average changes for the whole stock
So at this point in time, you need to be able to compute your actual stock, tp rework the new average - so i would think you need to store the current average in your product table (maybe store a history of such changes in a linked history table)
So this is not simple. And over time, it is likely to drift off (eg perhaps your system forgets to include some of the movement elements) and therefore you need a "reconciliation process" to recalculate it, and start again.
an alternative to this is something called standard costing
this says we expect the standard cost of a widget to be 10$ (say), which never changes - and therefore you use 10$ as your cost when caclulateing profits.
But when you buy stuff, you find out the real cost was only 9$ (say). Therefore you have a favourable variance to account for. And there are hundreds of different variances. (In fact using avco probably gives rise to some variances also, I think) Even if you use standard costing, there still has to be a mechanism to adjust your trading results to a historic cost, to satisfy the IR/IRS
This is why you want to use a system that is acceptable to the IR/IRS - that way you dont get variances you ned to adjust for.
There are no easy ways with inventory. Managing quantity is tricky but fun. Managing prices and value is extraoridnarily difficult. Proper large scale inventory systems are exceedingly complex, and not to be attempted lighlty.