maybe someone could help me. I get gross profit as 100% even all prices are set correctly, every time I do same workflow. (sales order → material request → purchase order and then invoices). Maybe someone could tell me what is a problem?
There are costs of buying and all orders are linked by material request. Seems like all prices set, links are attached. Most interesting fact in some older orders I get correct Gross Profit. I tried to see whats differs, cannot find anything… please help.
In your case, in gross profit report, buying amount is zero. There are 2 cases:
If item is a non-stock item, then buying amount calculated based on average rate in Purchase Invoice. Please check if you mentioned proper rate in Purchase Invoice.
In item is stock item, buying amount is calculated based on Stock Ledger Entry and as per FIFO. If quantity is negative, then it takes as per average rate in Stock Ledger Entries.
Do you make Purchase Receipts and Purchase Invoices?
Thank you for your concern. Yes i do Purchase Receipts and Purchase Invoices. All are linked together and I do them one after another (workflow). Interesting some of them shows gross profit (one of the first orders) and now it shows only 100% but nothing changed.
Yes it’s non stock item and rate is correct in Purchase Invoice. I tried everything what i can think about… lost & confused
It seem like I am having the same issue. Buying price is 0 for most of the items, even though I have entered Purchase receipt (and purchase invoice) accordingly. IS THERE A SOLUTION TO THIS? It is frustrating. Thanks.
This post is from 2015, I’ve got a got similar issue in 2021. Maybe I am doing something wrong but after intensive testing, the Buying Amount for Non-Stock item remains at 0.00 and gross profit wrongly calculates to 100%.
I’ve tried your solutions and correctly put in rates in the purchase invoice but the issue remains. I checked the demo instance at demo.erpnext.com and it shows a similar pattern.
I am sure there’s a solution to this. What am I missing here?
I replied on another similar post and got a solution to check for gross profit by projects but I don’t understand why the Buying Amount remains at zero for the non-stock items. If anyone’s reading this, this issue hasn’t been answered.
I looked at the code from what it looks like there is a part of the code where it changes the parent of a sales invoice item to the item code see below:
but then it will create a new key to store the parent_invoice
then there is this method get_buying_amount where it compares the stock ledger entries by the parent but since the item code is not used in the parent column it will not match anything leading to $0
Also found that there are cases where the parent stays the sames (meaning the name of the parenttype) and cases where it isn’t. Will need to dig deeper but adding the logic below seems to correct it.
parenttype, parent = row.parenttype, (row.parent_invoice if row.parenttype == “Sales Invoice” and row.parent_invoice else row.parent)