Is it possible to block the creation of a sales invoice if customer has an overdue invoice? If so, how?

I’ve been trying to deal with my customers that hasn’t paid their invoices. usually I block the creationg of invoices to those customers. The problem I have es that I dont make the invoices and I have another person that does it. If she forget about that “blockage”, the client is invoiced and the products get delivered without me wanting that.
So, can I block the creation of a sales invoice if customer has an overdue invoice? If so, how?
Hope someone can help me.
Cheers

You may check the status of the client in the Validate event.

You can use credit limit feature for this…

https://erpnext.com/docs/user/manual/en/accounts/credit-limit

2 Likes

Where can i check that?

I thought about it but I need to do it manually. In the credit limit section there’s nothing like what I need

You can ‘Disable’ the customer.

No user can create a new invoice against a disabled customer.

Would that limit my ability to create sales order? I only need to limit the ability to block the creation of sales invoices

Yes, disabling a customer in the customer record would also prevent you from creating sales orders.

BKM

Then credit limit would be the way to go. Under that, once the limit is crossed, you are blocked against creating an Order or invoice. When you check the Bypass option, it allows user to create Sales Order:

https://erpnext.com/docs/user/manual/en/accounts/credit-limit#22-bypass-credit-limit-check-for-sales-order

Until the credit limit is cleared or increased, you cannot create an invoice for that customer.

1 Like

The credit limit .AND. the overdue condition is what is necessary here. Like a client may have a $2000 credit limit. But an invoice for $500 that’s not paid on time should put the client on hold. I think this is something that many organizations would want. Maybe a bit of scripting that reduces the credit limit to 0 as long as there is an overdue invoice should do the trick.

Hope this helps

Thanks

Jay

1 Like

I also want to implement this. Did you ever get a solution to it? Thanks

2 questions:

  1. how to enforce delivery base on invoice?
  2. the ultimate requirement enforce no delivery creation(submit) when there is overdue invoice?

I did not get a solutions to this. I just had to rely on the person in charge of invoicing

This should be possible with simple server script. I will test and share the code in sometime.

In SI validate, check customer balance and frappe throw overdue warning.

That will be great! I’ll be waiting. Thanks

In Sales Invoice Doctype Event Before Save Add these below lines.

filters = {'docstatus': 1, 'customer': doc.customer, 'status': ('In', 'Unpaid,Overdue')}
total_unpaid = frappe.get_all("Sales Invoice", filters=filters)
if (total_unpaid):
    frappe.throw(_('Customer has an outstanding balance'))
6 Likes

This is awesome, how would one restrict the issue on Credit note/sale Return to "Account Manager " role only ?

You should check Role Based Permissions and User Permissions.

Hi, There is no option to select “Return/ Credit Note” under Permissions.

check the below sample client script for reference

1 Like