# Logic Behind Credit Limit Needs Improvement in erpNext

The credit limit functionality in erpnext needs to be improved since a lot of scenarios are missed by erpnext in considering the credit limit.

Here are the few examples to show the things.

First Scenario: If a customer has outstanding like 75k in accounts receivable but due to some reason the credit limit of the customer is revised to 50k, owing to some market scenarios then system would not allow any receipts of payments to be submitted for that customer. If the customer sends a payment of 10k then the balance credit would be left is 65k which is higher than the 50k credit limit set and hence the system would not allow for the submission of the JV. I think this implementation of the Credit Limit is wrong since the users should be allowed to submit JV where the customer is paying to reduce the Balance payment.

Second Scenario: Suppose the credit limit of the customer set is ZERO, the customer gives an order for 100k, then the Sales Order would not be allowed to be submitted since that would breach the Credit Limit (though we are not debit the customer as yet). Now in real life many a times the thing what happens is that the customer might provide an advance payment of say like 10% or 50% or anything which has been mutually decided. This would mean that the Sales Order should be submitted but Sales Invoice should not be allowed to be submitted after the receipt of the Advance.

Now the above 2 cases are very common, I presume, for all the users and I would like to know if anyone of the existing users have faced such scenarios with the Credit Limit introduced.

I know that there is a field where we could allow a Role to bypass the credit limits but I think bypassing the credit limit is something which should be avoided at least for majority of times.

Shouldnâ€™t the credit limits implementation be more robust in erpnext.

A better approach towards booking of Sales Orders would be to base the RISK Appetite on the items selected. Suppose there is a customer whose credit limit set is 100k. Then that customer gives an order for 1 item with price of 100/- per pc and quantity of 2000 Nos. Then the value of SO would be 100*2000 = 2,00,000. But if that item is a Run off the mill item then probably we could define the Risk appetite for that item at around 20% so that this particular order would add only 2,00,000 * 20% = 40,000/- over and above the amount due for receiving. So if there is an amount of 50k pending to be received then in that case the SO can be submitted since the organisation does not have a big risk in booking that order.

But on the other hand if someone gives an order for an item which is being made especially for that customer then probably the risk appetite for that item could be 30% and in that case if a customer has a Credit limit set at like 50k then there would be a need for about 10k to book this order as 30% of 200k = 60k and hence a payment of 10k from the customer would suffice the need for submitting the order.

When the material is ready to be dispatched then probably the total amount can be added for calculating the Credit Limit.

The reason for this long post is that we may not always want to change the credit limit just for booking the SO or JV.