Skip to content

Commit

Permalink
fix: currency formatter got incorrect format when use precision 0 (ba…
Browse files Browse the repository at this point in the history
…ckport #21239) (#21241)

* fix: currency formatter got incorrect format when use precision 0  (#21239)

* fix: currency formatter got incorrect format when use precision 0

* Revert "fix: currency formatter got incorrect format when use precision 0"

This reverts commit 1919cf4.

* fix: allow 0 as default precision

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
(cherry picked from commit 54fabab)

# Conflicts:
#	frappe/public/js/frappe/form/formatters.js

* Revert "fix: currency formatter got incorrect format when use precision 0  (#21239)"

This reverts commit 1d54c5d.

* fix: allow setting 0 as precision in formatter

---------

Co-authored-by: gn306029 <gn306029@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
3 people committed Jun 5, 2023
1 parent ad0efce commit fc48bda
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frappe/public/js/frappe/form/formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ frappe.form.formatters = {
},
Currency: function (value, docfield, options, doc) {
var currency = frappe.meta.get_field_currency(docfield, doc);
var precision = docfield.precision || cint(frappe.boot.sysdefaults.currency_precision) || 2;
var precision = cint(docfield.precision != null ? docfield.precision : frappe.boot.sysdefaults.currency_precision || 2);

// If you change anything below, it's going to hurt a company in UAE, a bit.
if (precision > 2) {
Expand Down

0 comments on commit fc48bda

Please sign in to comment.