frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
19.71k stars 7k forks source link

Credit Block comes too late, blocks invoices while it should put sales orders on hold #37888

Open bosue opened 10 months ago

bosue commented 10 months ago

Feature or bug may be debatable. Either way this is a followup to #37326.

Both credit limit exhaustion and the forthcoming maximum overdue invoices feature will currently lead to a credit block which is fine.

However, the implementation of a credit block seems flawed for quite a few cases.

  1. Sales orders should generally remain allowed to proceed as long as they‘re limited to advance payments, because in this case there‘s no additional credit risk.
  2. Any shipment that has already been carried out needs to remain invoicable. Blocking the invoice would otherwise further increase harm, after the company is already exposed to (additional) credit risk.
  3. Whenever a credit block is issued for whatever reason, blocking sales invoices comes a bit too late. You‘ve already registered the sales order, picked the items from the warehouse, maybe even ordered more from a supplier, and only then the credit block comes into play and blocks the last step, the actual invoice. Thats a bit late, and if already shipped, even far too late.

While you‘d still want to register a sales order, you might either want to put it on Hold until the credit block is lifted, so only a Payment Request may be issued, or you might want to issue a Sales Invoice limited to:

  1. payment in advance
  2. goods already delivered.

The central piece and first step would be putting Sales Orders on Hold here. From there, we need to figure out the rest.

Note that freezing a customer may and should be more than just a mere credit block. You wouldn‘t allow anything to be issued at all, not even a payment request, e.g. in the case of a money laundring or fraud suspect. But that‘s a different issue.

Module

accounts, selling

Version

Frappe / ERPNext: dev

rtdany10 commented 10 months ago

There is an optional validation on Sales Order side and another one at Delivery Note side as well, for credit limit. Doesn't it take care of the scenario you mentioned?

bosue commented 10 months ago

Well, there are various different scenarios in play. I will iterate through each and figure out what needs to be done to get each of them right. This shouldn’t block your PR though.