First of all, we need to set the quantity of document line to be calculated by selecting "1st quantity, variable" from the settings-> Purchases /