From 418de90647a79679650181e9d886057fdcfeda2d Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Tue, 21 Jun 2022 22:09:58 +0800 Subject: [PATCH] [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. --- gnucash/gnome/assistant-stock-transaction.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gnucash/gnome/assistant-stock-transaction.cpp b/gnucash/gnome/assistant-stock-transaction.cpp index 25e6bc001b..f813dd0a54 100644 --- a/gnucash/gnome/assistant-stock-transaction.cpp +++ b/gnucash/gnome/assistant-stock-transaction.cpp @@ -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,