ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Random Postings into COGS Accounts

Hello all,

I am witnessing a situation that is making me go bald prematurely.

ERPNext appears to be posting random figures into the COGS account when Purchase Receipts are created.

For example look at the flow below;

A purchase Receipt worth NGN113,400 is created as shown below

Both items have maintain stock checked.

To my surprise see below the Accounting ledger postings made by ERPNext for this transaction

Why the humongous 6,409,000 posting into Cost of Goods Sold? Why any posting into Cost of Goods Sold Account for purchases 0f an item with maintain stock checked?

This issue is happening in Versions 13.13 as well as Version 13 beta.

Is there anyone that can let me know what I am doing wrong?

This is amazingly perplexing.

Olamide

Can you check the GL Entry doctype and see what is posted? Cheers

Thanks @Not_a_countant

Same entries posted as seen below

Can you paste the JSON on the MR?

MR? You mean Purchase Receipt?

Could you explain this request better, I do not understand what you are asking me to paste

Yes the JSON from PR. Thanks
The following will list your PR in a JSON format.
http://yoursite/api/resource/Purchase Receipt/[id]

{“data”:{“name”:“MAT-PRE-2021-00380”,“owner”:“john@”,“creation”:“2021-10-14 10:56:18.717767”,“modified”:“2021-10-14 10:59:22.744884”,“modified_by”:“john@”,“idx”:0,“docstatus”:1,“title”:“D’Aladson”,“naming_series”:“MAT-PRE-.YYYY.-”,“supplier”:“D’”,“supplier_name”:“D”,“company”:“TP”,“posting_date”:“2021-10-14”,“posting_time”:“10:56:57.048118”,“set_posting_time”:0,“is_return”:0,“currency”:“NGN”,“conversion_rate”:1.0,“buying_price_list”:“Standard Buying”,“price_list_currency”:“NGN”,“plc_conversion_rate”:1.0,“ignore_pricing_rule”:0,“set_warehouse”:“Stores - TPSPx”,“is_subcontracted”:“No”,“scan_barcode”:"",“total_qty”:4.0,“base_total”:113400.0,“base_net_total”:113400.0,“total_net_weight”:0.0,“total”:113400.0,“net_total”:113400.0,“tax_category”:"",“base_taxes_and_charges_added”:0.0,“base_taxes_and_charges_deducted”:0.0,“base_total_taxes_and_charges”:0.0,“taxes_and_charges_added”:0.0,“taxes_and_charges_deducted”:0.0,“total_taxes_and_charges”:0.0,“apply_discount_on”:“Grand Total”,“base_discount_amount”:0.0,“additional_discount_percentage”:0.0,“discount_amount”:0.0,“base_grand_total”:113400.0,“base_rounding_adjustment”:0.0,“base_in_words”:“NGN One Hundred And Thirteen Thousand, Four Hundred only.”,“base_rounded_total”:0.0,“grand_total”:113400.0,“rounding_adjustment”:0.0,“rounded_total”:0.0,“in_words”:“NGN One Hundred And Thirteen Thousand, Four Hundred only.”,“disable_rounded_total”:1,“status”:“Completed”,“per_billed”:100.0,“per_returned”:0.0,“is_internal_supplier”:0,“letter_head”:“TP”,“language”:“en”,“group_same_items”:0,“doctype”:“Purchase Receipt”,“items”:[{“name”:“607ad4dc96”,“owner”:“john@”,“creation”:“2021-10-14 10:56:18.717767”,“modified”:“2021-10-14 10:59:22.369985”,“modified_by”:“john@”,“parent”:“MAT-PRE-2021-00380”,“parentfield”:“items”,“parenttype”:“Purchase Receipt”,“idx”:1,“docstatus”:1,“barcode”:“5391517512175”,“item_code”:“REVIVE ACTIVE EASILY ABSORBED 381G X30”,“item_name”:“REVIVE ACTIVE EASILY ABSORBED 381G X30”,“description”:“REVIVE ACTIVE EASILY ABSORBED 381G X30”,“item_group”:“SUPPLEMENTS/HERBALS”,“image”:"",“received_qty”:2.0,“qty”:2.0,“rejected_qty”:0.0,“uom”:“Unit”,“stock_uom”:“Unit”,“conversion_factor”:1.0,“retain_sample”:0,“sample_quantity”:0,“received_stock_qty”:2.0,“stock_qty”:2.0,“returned_qty”:0.0,“price_list_rate”:0.0,“discount_percentage”:0.0,“discount_amount”:0.0,“base_price_list_rate”:0.0,“rate”:30000.0,“amount”:60000.0,“base_rate”:30000.0,“base_amount”:60000.0,“is_free_item”:0,“net_rate”:30000.0,“net_amount”:60000.0,“base_net_rate”:30000.0,“base_net_amount”:60000.0,“valuation_rate”:30000.0,“item_tax_amount”:0.0,“rm_supp_cost”:0.0,“landed_cost_voucher_amount”:0.0,“billed_amt”:60000.0,“current_sale_price”:39000.0,“suggested_sale_price”:42000.0,“update_selling_price”:1,“warehouse”:“Stores - TPSPx”,“is_fixed_asset”:0,“allow_zero_valuation_rate”:0,“serial_no”:"",“include_exploded_items”:0,“batch_no”:“337L2”,“expense_account”:“Cost of Goods Sold - TPSPx”,“item_tax_rate”:"{}",“weight_per_unit”:0.0,“total_weight”:0.0,“cost_center”:“Main - TPSPx”,“page_break”:0,“doctype”:“Purchase Receipt Item”},{“name”:“5ad55cade7”,“owner”:“john@”,“creation”:“2021-10-14 10:56:18.717767”,“modified”:“2021-10-14 10:59:22.370971”,“modified_by”:“john@”,“parent”:“MAT-PRE-2021-00380”,“parentfield”:“items”,“parenttype”:“Purchase Receipt”,“idx”:2,“docstatus”:1,“barcode”:“794712770978”,“item_code”:“REVIVE ACTIVE BEAUTY COMPLEX X30”,“item_name”:“REVIVE ACTIVE BEAUTY COMPLEX X30”,“description”:“REVIVE ACTIVE BEAUTY COMPLEX X30”,“item_group”:“SUPPLEMENTS/HERBALS”,“image”:"",“received_qty”:2.0,“qty”:2.0,“rejected_qty”:0.0,“uom”:“Unit”,“stock_uom”:“Unit”,“conversion_factor”:1.0,“retain_sample”:0,“sample_quantity”:0,“received_stock_qty”:2.0,“stock_qty”:2.0,“returned_qty”:0.0,“price_list_rate”:26700.0,“discount_percentage”:0.0,“discount_amount”:0.0,“base_price_list_rate”:26700.0,“rate”:26700.0,“amount”:53400.0,“base_rate”:26700.0,“base_amount”:53400.0,“is_free_item”:0,“net_rate”:26700.0,“net_amount”:53400.0,“base_net_rate”:26700.0,“base_net_amount”:53400.0,“valuation_rate”:26700.0,“item_tax_amount”:0.0,“rm_supp_cost”:0.0,“landed_cost_voucher_amount”:0.0,“billed_amt”:53400.0,“current_sale_price”:38000.0,“suggested_sale_price”:37380.0,“update_selling_price”:0,“warehouse”:“Stores - TPSPx”,“is_fixed_asset”:0,“allow_zero_valuation_rate”:0,“serial_no”:"",“include_exploded_items”:0,“batch_no”:“399L1”,“expense_account”:“Cost of Goods Sold - TPSPx”,“item_tax_rate”:"{}",“weight_per_unit”:0.0,“total_weight”:0.0,“cost_center”:“Main - TPSPx”,“page_break”:0,“doctype”:“Purchase Receipt Item”}],“pricing_rules”:[],“supplied_items”:[],“taxes”:[]}}

Thanks Olamide…there is nothing wrong in what you booked. Looks like the controller is doing something.

And am not the only one

This is worrisome

I learned that advanced payment (for buying or selling) creates entry in COGS account when Maintain Stock is checked.
This is because the stock movement and money movement is not at the same time so an entry in temporary account (i.e COGS) is made.
I see that you have Stock Received But Not Billed as the counter to the COGS. This needs to be moved to AP/AR so when paid it will be reduced, otherwise it will accummulated and not offset.

Maybe you can get something from my post here:

and here:

What was the stock balance before you submitted the purchase receipt? Sometimes system will create entries to adjust the difference in valuation rate. Please check the stock ledger of the items which was in negative stock level.

Hello @rahy

Stock Received but not billed is NOT the counter to the COGS. Stock received but not billed is supposed to be the Counter to the Stock in hand account when Purchase Invoice is yet to be raised. When Purchase Invoice is raised the entry in the Stock Received but not billed account will be reversed. This is the normal practice.

The appearance of COGS in this transaction is the anomaly we are trying to resolve, it makes no sense.

No advance payment was raised for this transaction.

The expense for the item goes here.
It may be not directly related to my posts, but I think the problem is similar. The expense goes to COGS hence the accummulated value. I believe there are some posts discussing this expense account for items.

Expense should not go here during a purchase receipt, there is no expense when you are buying inventory, it is simply an exchange of one asset (bank/cash) for another (inventory). Instead of bank asset you could also be exchanging liability if you are not paying yet.

No expensing should be happening yet.

A some point I also think similar to you when my client questioned me of the same accumulated COGS account and the Difference Account.
Perhaps you can search the post and discuss it there. I believe I saw several posts in this week alone. Use keyword: creditor account, cost of goods sold, item expense, difference account, among other related keywords.