Manufactured goods valuation

I’m not sure what this error message is point me at. But all the valuations are the same as per this image

I’ve no idea the rationale behind

 if valuation_at_target < valuation_at_source:
frappe.throw(bla bla) 

but commenting those lines out in now lets me save either repack or manufacture stock entries pertaining to a giving production order.

Can you post this in a GitHub Issue - I think @nabinhait has a solution for this.

Removed the validation via Fixes by nabinhait · Pull Request #2591 · frappe/erpnext · GitHub

Actually what was happening, valuation rate for finished goods was calculating based on valuation rate for issued items. While doing that due to precision and divisional loss, the exact amount is not set for finished goods. For example, if you multiply 27000 and .175, you will not get 4819.632.

1 Like

Great. Because that validation would fail in quite a number of cases, as it’s done for me a number of times because of like you said, floating point issues. That brings me to the point that does the system do floating point rounding in the background?

For instance in Java, I can set the scale of BigDecimal to say 2, and that will hold true for any use of that particular variable. Is there any such thing being used by ERPNext, because again, I’ve had instances where trying to cancel a saved voucher fails because with the message “debit not same as credit. Difference is 0.0000115555” or something along those lines.

While calculating totals, taxes etc in Sales Invoice, system does rounding in each step using field/global precision. We have handled precision issues in most cases, debit != credit should not come. If you are still getting this error, will request you to provide the data you are using to replicate the case. You can also try to replicate the issue in and tell us the invoice no.

So here’s another decimal hell scenario.

As per the bill of material, I need 25KG of HDPE to make 781 pcs of the finished goods. Now I want to make 5000 pcs of the finished goods. This means 160.051KG of HDPE will be required, which the system gets fine. But the valuation somehow seems to not equal to each other. Dunno what to do. I’m running 4.19, fully updated.

One interesting thing I noticed is if I change the date of the raw material transfer stock entry to today’s date, 23.1.15, it saves fine. But if I change it to the real day the transfer actually took place, which was 13.1.15, the decimal error pops up