[assistant-stock-transaction] dividends must include stock account

bugfix. A stock account split must always be included in the stock
transaction.

This bug would manifest with a pure dividend transaction; it would
create a transaction from Income:Dividend to Cash. To be properly
reported in the portfolio and IFRS reports, a zero-amount and
zero-value stock split must be included.
This commit is contained in:
Christopher Lam 2022-06-21 22:09:58 +08:00
parent afa21eaf4f
commit 418de90647

View File

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