How to add inventory function in form?