mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Set the transaction currency during auto-completion.
When auto-completing a transaction that was originally created in another account with a different currency the balancing code will try to apply conversions in the wrong direction if one edits the transaction. Explicitly setting the transaction currency to the current register's currency prevents the conversions being applied and allows the transaction to balance correctly.
This commit is contained in:
parent
d0e103be08
commit
3109b6f6c3
@ -885,11 +885,15 @@ gnc_split_register_auto_completion (SplitRegister *reg,
|
|||||||
|
|
||||||
if (gnc_split_register_get_default_account (reg) != NULL)
|
if (gnc_split_register_get_default_account (reg) != NULL)
|
||||||
{
|
{
|
||||||
Account *default_account;
|
Account *default_account =
|
||||||
|
gnc_split_register_get_default_account (reg);
|
||||||
|
gnc_commodity *trans_cmdty = xaccTransGetCurrency(trans);
|
||||||
|
gnc_commodity *acct_cmdty = xaccAccountGetCommodity(default_account);
|
||||||
Split *s;
|
Split *s;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
if (gnc_commodity_is_currency(acct_cmdty) &&
|
||||||
default_account = gnc_split_register_get_default_account (reg);
|
!gnc_commodity_equal(trans_cmdty, acct_cmdty))
|
||||||
|
xaccTransSetCurrency(trans, acct_cmdty);
|
||||||
|
|
||||||
while ((s = xaccTransGetSplit(trans, i)) != NULL)
|
while ((s = xaccTransGetSplit(trans, i)) != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user