Purchase Receipt: Multiple Stock Received but not Billed Accounts?

Hello Community,

I need the ability to post stock from any of the hundreds of stock received but not billed accounts I have.

I’ve been able to solve this by altering the core ERPNext source. I don’t want to keep it like this for long because I won’t be able to keep up the maintenances on each update.
I just changed the stock_rbnb to read from a custom field on Purchase Receipt form.

I’m able to do the exact same thing with Purchase Invoice except I can do it via a custom script. This is because I’m able to set the income account of each purchase invoice item to the specific account required for this shipment.

I noticed there is also a expense account in the Purchase Receipt Item doctype. Unfortunately, regardless of setting the account there it doesn’t effect the ledger and still posts to the company default stock received but not billed account.

I’m wondering if our companies procedure is dated. Maybe ERPNext has a better way to handle this.

Our receiving process is as follows:

  1. We create a GL Account based on the Bill of Landing # for this shipment.
  2. We add all Supplier(s)/Fright/Duty invoices to the newly created account.
  3. About 2-3 months later we receive the goods.
  4. We create a purchase receipt for each of the supplier shipments.
  5. Each purchase receipt will credit the account and debit stock when submitted.
  6. Landed cost voucher is created.
  7. We validate the job was done correctly by closing the account based on the bill of landing. If the account balance is $0.00 the job is done correctly. If there is still balance remaining someone most likely forgot to add an invoice or did landed cost incorrectly.

Step 7 is crucial to our receiving process. This allows us to make sure 100% this shipment has been booked correctly.

If anyone has any suggests to accomplish this without modify ERPNext core. It would be much appreciated.

What is the solution for this problem. @dj12djdjs
I also need to change my stock received but not billed account based on the Item groups

Hi @Chandru_B ,

My solution was to create a custom app, using override_doctype_class hook I’ve overrided get_company_default in Purchase Invoice, and Purchase Receipt. I’ve been using this for a couple years starting on version-13, now on version-14. I’ve not tested on version-15.

from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import PurchaseInvoice


class CustomPurchaseInvoice(PurchaseInvoice):
    def get_company_default(self, fieldname, ignore_validation=False):
        if fieldname == "stock_received_but_not_billed":
            return "My Custom Delivery Account - DC"
        return super().get_company_default(fieldname)
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import PurchaseReceipt


class CustomPurchaseReceipt(PurchaseReceipt):
    def get_company_default(self, fieldname, ignore_validation=False):
        if fieldname == "stock_received_but_not_billed":
            return "My Custom Delivery Account - DC"
        return super().get_company_default(fieldname)
1 Like

Thanks for the solution
Isn’t Frappe has any solution to this?