[assistant-stock-transaction] send stock_amt | stock_val fieldmask

because the stock_value may be FieldMask::DISABLED with a stock split
in a short position. The | operator ensures FieldMask::ENABLED_CREDIT
is used, which negates the stock amount.
This commit is contained in:
Christopher Lam 2022-08-29 13:48:57 +08:00
parent 6d15e924db
commit 70abdbd1ae

View File

@ -1005,7 +1005,7 @@ stock_assistant_finish (GtkAssistant *assistant, gpointer user_data)
auto date = gnc_date_edit_get_date (GNC_DATE_EDIT (info->date_edit)); auto date = gnc_date_edit_get_date (GNC_DATE_EDIT (info->date_edit));
xaccTransSetDatePostedSecsNormalized (trans, date); xaccTransSetDatePostedSecsNormalized (trans, date);
create_split (trans, info->txn_type->stock_value, create_split (trans, info->txn_type->stock_amount | info->txn_type->stock_value,
NC_ ("Stock Assistant: Action field", "Stock"), NC_ ("Stock Assistant: Action field", "Stock"),
info->acct, account_commits, info->stock_memo_edit, info->acct, account_commits, info->stock_memo_edit,
info->txn_type->stock_amount != FieldMask::DISABLED ? info->stock_amount_edit : nullptr, info->txn_type->stock_amount != FieldMask::DISABLED ? info->stock_amount_edit : nullptr,