Bug 798219 - Price dialog prices truncated

Correct previous commit that truncates decimal places of prices entered
in the price dialog to that of the currency, they should not be rounded.
This commit is contained in:
Robert Fewell
2021-07-08 14:56:48 +01:00
parent 0f026f6a10
commit 8d66754429

View File

@@ -138,6 +138,7 @@ type_index_to_string (int index)
static void
price_to_gui (PriceEditDialog *pedit_dialog)
{
GNCPrintAmountInfo print_info;
gnc_commodity *commodity = NULL;
gnc_commodity *currency = NULL;
const gchar *name_space, *fullname;
@@ -189,6 +190,10 @@ price_to_gui (PriceEditDialog *pedit_dialog)
gtk_combo_box_set_active (GTK_COMBO_BOX(pedit_dialog->type_combobox),
type_string_to_index (type));
print_info = gnc_commodity_print_info (currency, FALSE);
gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), print_info);
gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), 0);
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), value);
}
@@ -277,8 +282,7 @@ gui_to_price (PriceEditDialog *pedit_dialog)
print_info = gnc_commodity_print_info (currency, FALSE);
gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), print_info);
gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (pedit_dialog->price_edit),
gnc_commodity_get_fraction (currency));
gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), 0);
if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (pedit_dialog->price_edit), NULL))
return _("You must enter a valid amount.");