Bug 746792 - process payment in foreign currency leads to broken equation

To avoid confusion the payment dialog will now display the currency
to interpret the amount fields in.
This commit is contained in:
Geert Janssens
2015-06-13 17:45:23 +02:00
parent ec8ed38860
commit 81dace1751
2 changed files with 38 additions and 0 deletions

View File

@@ -71,6 +71,7 @@ struct _payment_window
GtkWidget * date_edit;
GtkWidget * acct_tree;
GtkWidget * docs_list_tree_view;
GtkWidget * commodity_label;
gint component_id;
QofBook * book;
@@ -122,6 +123,21 @@ void gnc_ui_payment_window_set_amount (PaymentWindow *pw, gnc_numeric amount)
}
}
static void gnc_ui_payment_window_set_commodity (PaymentWindow *pw, const Account* account)
{
gchar *comm_string;
gnc_commodity *comm;
g_assert(pw);
g_assert(account);
comm = xaccAccountGetCommodity (account);
comm_string = g_strconcat ("(", gnc_commodity_get_nice_symbol (comm), ")", NULL);
gtk_label_set_text (GTK_LABEL(pw->commodity_label), comm_string);
g_free (comm_string);
}
void gnc_ui_payment_window_set_postaccount (PaymentWindow *pw, const Account* account)
{
g_assert(pw);
@@ -131,7 +147,10 @@ void gnc_ui_payment_window_set_postaccount (PaymentWindow *pw, const Account* ac
gnc_cbwe_set_by_string(GTK_COMBO_BOX(pw->post_combo), acct_string);
g_free(acct_string);
}
gnc_ui_payment_window_set_commodity (pw, account);
}
void gnc_ui_payment_window_set_xferaccount (PaymentWindow *pw, const Account* account)
{
g_assert(pw);
@@ -489,6 +508,10 @@ gnc_payment_dialog_owner_changed (PaymentWindow *pw)
pw->acct_commodities = gncOwnerGetCommoditiesList (owner);
pw->post_acct = gnc_account_select_combo_fill (pw->post_combo, pw->book, pw->acct_types, pw->acct_commodities);
if (pw->post_acct)
gnc_ui_payment_window_set_commodity (pw, pw->post_acct);
/* Update list of documents and pre-payments */
gnc_payment_window_fill_docs_list (pw);
@@ -909,6 +932,7 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
pw->ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "okbutton"));
pw->num_entry = GTK_WIDGET (gtk_builder_get_object (builder, "num_entry"));
pw->memo_entry = GTK_WIDGET (gtk_builder_get_object (builder, "memo_entry"));
pw->commodity_label = GTK_WIDGET (gtk_builder_get_object (builder, "commodity_label"));
pw->post_combo = GTK_WIDGET (gtk_builder_get_object (builder, "post_combo"));
gtk_combo_box_set_entry_text_column( GTK_COMBO_BOX( pw->post_combo ), 0 );
gnc_cbwe_require_list_item(GTK_COMBO_BOX(pw->post_combo));

View File

@@ -535,6 +535,20 @@ In case of an over-payment or if no invoice was selected, GnuCash will automatic
<property name="y_padding">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="commodity_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">(USD)</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>