Try ERPNext Buy Support Partners Foundation Foundation Members

[v12.1.6] Decimals in Currencies not working

Installed Apps
ERPNext: v12.1.6 (version-12)
Frappe Framework: v12.0.16 (version-12)

I’ve recently updated to v12.1.6. Afterwards the currencies are not working as expected.

The issue is about decimals:

  • 5 converts to 5.00 (correct)
  • 5,1 converts to 51,00 (wrong)
  • 5,123 converts to 5.123,00 (wrong)

The same happens when I use points instead of comma. Any ideas what’s happening here?

edit: same as Decimals behaving strangely

3 Likes

Quantaties, percentages, etc. are working as expected. Only currencies are wrong.

Can confirm, experiencing this bug as well.

3 Likes

I have justed posted the same.

1 Like

@Tufan_Kaynak2 Can you please link your post here? Makes it easier for other to follow up…

@Tufan_Kaynak2 @eds have you already opened an issue on github for that bug?

The bug is everywhere! It is also in Journal Entry lines.

Whoever was playing around with this, can he/she explain please?

The product is totally unusable now!

I have not, since I don’t have a github account. I’m trying to look into the issue first, though I just installed ERPNext for the first time so it might take a while.

I did not create a GitHub issue. Will you?

I’ve just reported the bug on gihub.

Please see: https://github.com/frappe/erpnext/issues/19255

1 Like

Also same with me.

Dears, a temporary solution is:
to remove the following lines:

	eval_expression: function(value) {
		if (typeof value === 'string' 
			&& value.match(/^[0-9+-/* ]+$/)
			// paresFloat('1,44,000') returns 1.0
			// 1,44,000 are being passed when we paste rows from excel sheet to a table
			&& value.includes(',')) {
			return value.replace(",", "");
		}
		return value;
	},

from file:
/frappe/bench/apps/frappe/frappe/public/js/frappe/form/controls/currency.js

and run:
bench build

then please reload at your erpnext page

2 Likes

https://github.com/frappe/frappe/pull/8497#issue-321121247 that is the update that effed up everything

2 Likes

Thanks for this forensic work Tufan_Kaynak2

Those links and notes provide lots for learning

1 Like

Still isn’t working everywhere though. I did a stock reconciliation, type = opening, and although the value in the table is correct, the saved value showing up in the ledger is still the same with the original problem. Perhaps the changes are deeper than just this.

You need to check the controller code for the DocType you are working on and the business rules enforced on the data or any alterations made to the code in GitHub that has been lately committed. I will check and get back to you if I happen to find a legitimate lead to the cause.

The controller code looks fine. I’ve reverted that PR’s code just to be safe, and is looking through merged commits that touches on stock valuation. I’ll post here if I find anything.

I cant reproduce it, on my system, eval 12.1.6, everything is fine!

The bug happens if Erpnext has the default decimal separator set to comma ( , ). If it’s set to dot ( . ), everything works as intended.

I’ve just reinstalled Erpnext to confirm this, and yes it only happens when the separator is set to comma.

Tufan_Kaynak2 's recommendation to revert the previously quoted PR works when displaying, but the stored value remains. Perhaps there’s something to do with the field type? Float or currency?

2 Likes