Paying Supplier based on sold Stock


I am new to ERPNext, but have been reading up the documentations and also various forums on how to use/customize it. Recently one of my clients wants us to customize ERPNext for his new business.

Unlike the current process for getting stocks from the supplier, he has managed to reach an agreement with the supplier to only pay what he sold, which is different from the default ERPNext buying flow.

Can anyone point me in the right direction on how to get this customized? Basically he would use the purchase invoice → purchase receipt to acquire stock, however, the payment would not be fulfilled based on a credit term or limit criteria, but rather based on the stocks that were sold. The client would then issue a payment to the supplier based on the price to his supplier on a bi-weekly or monthly basis.

Currently, we're thinking of making the custom report that lists down sold and unpaid items, and then issue purchase invoice based on this report. However, what should we do with the purchase order issued earlier? just close it off?

Can anyone suggest a better way of achieving this?

1 Like

So you have the standard Purchase to Pay cycle. PO>PREC>Purchase Invoice>Payment.

And here’s what happens at each stage:

PO - It’s juts a contract - It does not hit your client’s financials.

Purchase Receipt - Your client’s current assets>Stock Assets go up by the appropriate amount in the PREC. To balance it out it hits the Stock Received but not Billed account.

One thing is managing this process. It’s an entire different thing to manage it robustly and to ensure that the Financials of your client complies with appropriate laws.

If your client says, I need a totally robust and perfect method to manage the process:

  1. Do a PO on ERPNext - A PO is only a contract and does not hit your client’s book of accounts.
  2. Set the Items up as Stock Items
  3. Instead of a Purchase Receipt - do a Stock Entry purpose Material Receipt. Use “Stocks on Loan from Supplier A” as the Difference Account and the account should be on the Liability side of your Balance Sheet. This could even be a special Accounts Payable account created for your supplier. Though if you use a Payable account, it will mess up your Accounts Payable statements. So best is for it not to be an Accounts Payable account, but another liability account.
  4. Now as Products are Sold, you come back and raise a Purchase Invoice for the amount, use the “Stocks on Loan from Supplier A” as the Expenses Account at the Purchase Invoice Item level. That will hit the Supplier A Accounts Payable and when you pay your Supplier, it will all get appropriately squared up.

You can use WebHooks to customize many of these choices, I think, and thereby reduce or eliminate errors.

If you are not too worried about getting your books correct on a real time basis, you can create a separate Warehouse for the Stocks that are on Loan and just go through the standard ERPNext’s Purchase to Pay process. You may have to interpret some of your General Ledger account balances appropriately and pass Journal Entries before the periodic closing of accounts.

I am no accountant, so please run all of these past a qualified accountant before you take it at face value.

Hope this helps.



1 Like

Thanks for your suggestion! Sounds doable and already reading up on webhooks now. Will update here about what we found out.

this is a typical consignment process, in SAP, the high level process flow is as following

  1. Issue consignment PO to vendor, it is normally a quantity contract without price, special consignment info record (price) is maintained as price master
  2. Do goods receipt against the consignment PO, book received quantity to inventory, also assign the stock to the vendor and mark it as special stock K. at this point, the vendor still owns this stock, so there is no posting to the accounts/general ledger.
  3. Consume the consignment stock with following 2 options
    3.1 Convert the consignment stock to own stock,
    3.2 Directly issue from consignment stock, actually the system first implicitly convert consignment stock into own stock, then issue the stock from own stock
    at this point, the accounts posting for normal goods receipt against PO get booked, consignment price from price master other than the PO price is used, because in the relevant stock movement records(convert from consignment to own stock), there is no purchase order tracked.
    Dr. Stock
    Cr. GR/IR goods received, invoice not received( goods received, not billed)
  4. Run report to get all consumed consignment stock during the period, Notify vendor to invoice accordingly
  5. Create purchase invoice / settlement, quantity taken from the stock movement, price taken from the price master.

Seems this is still a missing feature, if the above mentioned SAP process flow is acceptable, we can think to implement the same in ERPNext.

1 Like

Would be great for ERPNExt to have a consignment stock flow process.

For the time being, I think your suggestion makes perfect and valid sense.

We’ll probably need to produce some monthly custom reports to compute the supplier’s settlement and then request them to issue invoice according to that report, everything is cool as long as the practice doesn’t end up with account payable being calculated twice.

Hi Jonathan,

Did you manage to get this right at your end? We have a similar process as follows:

  1. New Special Stock Requisition is made to the manufacturer to be held in a special warehouse controlled by the manufacturer. (No liability at this stage on us).

  2. Goods are received and checked against a delivery note and Special Stock Requisition. These goods are then stored in Manufacturer Controlled Warehouse. (No liability on us, so far).

  3. Stock Requisition is made and sent to Manufacturer Controlled Warehouse and physical stock is moved from there to Shop Stores. At this stage, liability is created and stocks taken on books. In ERPN, it will be debited to Stocks Received But Not Yet Billed and credited to Creditors.

  4. At the start of the next month, the manufacturer raises an invoice for all Stock Requisitions. How do we handle this invoice?

Plz guide which GL Accounts should be hit at each process.


We had to customize the code quite a bit and due to stock being enabled with “Has Serial” we were able to put some status onto the Serial No items itself.

From there we track the status such as : “Goods Received but not billed” from the purchasing flow.

then on the sales flow we updated the status of each serial number: “Sold but principal not settled” , “Sold but principal paid”
and have it auto populate the Sales Invoice item table based on such status…it’s quite a big tweak.