[Vtigercrm-developers] Negative values

John Crisp john at reetspetit.net
Thu May 27 05:18:43 PDT 2010


I have been trying to allow negative values for Credit Notes and am well 
& truly stuck and wondered if anyone had any suggestions - see my posts 
http://forums.vtiger.com/viewtopic.php?p=107753

I have managed to allow negative prices in Invoices by amending the 
following :

Inventory.js around Line 334

 From :
if (!numValidate("listPrice"+i,alert_arr.LIST_PRICE,"any")) return false


To :
if (!numValidate("listPrice"+i,alert_arr.LIST_PRICE,"any","1")) return false

But it would be better to allow a negative quantity.

I tried to change the following and add ,"1"

 From :
if (!numValidate("qty"+i,"Qty","any")) return false

To :
if (!numValidate("qty"+i,"Qty","any","1")) return false

If I put in a 1 I get 'Qty should be greater than 0' If I put a 0 I get 
'Invalid Quantity'

I don't understand why it works for one piece of code, but not for the 
other ! Is there something else going on in the numValidate function in 
general.js ?

My guess is that if this cold be solved there is nothing to stop 
creating a Credit Invoice module as it would be pretty well exactly the 
same as an Invoice but with negative numbers, or at least decrementing 
the stock and a minus Total.

Any assistance or thoughts greatly appreciated



More information about the vtigercrm-developers mailing list