Skip to content

Commit

Permalink
fix(number_card): ensure value is returned
Browse files Browse the repository at this point in the history
In the case of a number card based on a query report, an integer with
a very basic DF is passed, leading to the "formatted" value being just
the integer as a string, which becomes an empty string after $().text()

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
(cherry picked from commit 7695a0d)
  • Loading branch information
akhilnarang authored and mergify[bot] committed May 29, 2024
1 parent d100a64 commit 0a91f04
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions frappe/public/js/frappe/widgets/number_card_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,8 @@ export default class NumberCardWidget extends Widget {

const symbol = number_parts[1] || "";
number_parts[0] = window.convert_old_to_new_number_format(number_parts[0]);
const formatted_number = $(frappe.format(number_parts[0], df, null, doc)).text();

this.formatted_number = formatted_number + " " + __(symbol);
const formatted_number = frappe.format(number_parts[0], df, null, doc);
this.formatted_number = $(formatted_number).text() || formatted_number + " " + __(symbol);
}

_generate_common_doc(rows) {
Expand Down

0 comments on commit 0a91f04

Please sign in to comment.