To add maximum stock while creating item first Go to Master > select Item
Then the item view is display, then to create new Item Click on the New button present on the top left of corner.
Then fill all the details related to an item in which you can see the Maximum Stock field enter the value of Maximum stock which you wish to set for that item.
Once you set Maximum stock value then at the time of purchase, if the stock reaches up to maximum stock value then it will show a warning message.
To setup error message for item when stock become Overstocked Click here