Skip to content

Commit

Permalink
Bug 787813 - Price change from editing a transaction not reflected...
Browse files Browse the repository at this point in the history
in pricedb.

Allow PRICE_SOURCE_SPLIT_REG to overwrite PRICE_SOURCE_XFER_DLG_VAL.
  • Loading branch information
jralls committed Jun 10, 2021
1 parent 9546c05 commit 80d6749
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions gnucash/register/ledger-core/split-register.c
Expand Up @@ -2223,7 +2223,6 @@ gnc_split_register_auto_calc (SplitRegister* reg, Split* split)
Account* account;
int denom;
int choice;
PriceSource source = PRICE_SOURCE_USER_PRICE;

if (STOCK_REGISTER != reg->type &&
CURRENCY_REGISTER != reg->type &&
Expand Down Expand Up @@ -2372,7 +2371,6 @@ gnc_split_register_auto_calc (SplitRegister* reg, Split* split)
{
recalculate_price (split, reg, value, amount);
price_changed = TRUE;
source = PRICE_SOURCE_SPLIT_REG;
}
if (recalc_value)
recalculate_value (split, reg, price, amount, shares_changed);
Expand Down
5 changes: 4 additions & 1 deletion libgnucash/engine/Transaction.c
Expand Up @@ -3009,14 +3009,17 @@ record_price (Split *split,

if (price)
{
PriceSource oldsource = gnc_price_get_source (price);
price_value = gnc_price_get_value (price);
if (gnc_numeric_equal (swap ? gnc_numeric_invert (value) : value,
price_value))
{
gnc_price_unref (price);
return;
}
if (gnc_price_get_source (price) < source)
if (oldsource < source &&
!(oldsource == PRICE_SOURCE_XFER_DLG_VAL &&
source == PRICE_SOURCE_SPLIT_REG))
{
/* Existing price is preferred over this one. */
gnc_price_unref (price);
Expand Down

0 comments on commit 80d6749

Please sign in to comment.