mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Don't require prices in Scheduled Transactions with marker commodity splits.
Bug 754192 - Since Last Run Dialog asks for security price even if not needed Bug 662126 - Cannot create scheduled transaction for dividend reinvestment If a split in an SX has a 0 amount, don't make its commodity the transaction commodity, set the multi-commodity flag, or create a variable for it. Make the warning about not being able to auto-create SXes with variables or multiple commodities more explicit about the latter.
This commit is contained in:
parent
ce838d3cfc
commit
d061f6e962
@ -193,6 +193,7 @@ _get_vars_helper(Transaction *txn, void *var_hash_data)
|
||||
gnc_commodity *split_cmdty = NULL;
|
||||
GncGUID *acct_guid;
|
||||
Account *acct;
|
||||
gnc_numeric split_amount;
|
||||
|
||||
s = (Split*)split_list->data;
|
||||
kvpf = xaccSplitGetSlots(s);
|
||||
@ -203,12 +204,14 @@ _get_vars_helper(Transaction *txn, void *var_hash_data)
|
||||
acct_guid = kvp_value_get_guid(kvp_val);
|
||||
acct = xaccAccountLookup(acct_guid, gnc_get_current_book());
|
||||
split_cmdty = xaccAccountGetCommodity(acct);
|
||||
if (first_cmdty == NULL)
|
||||
split_amount = xaccSplitGetAmount(s);
|
||||
if (!gnc_numeric_zero_p(split_amount) && first_cmdty == NULL)
|
||||
{
|
||||
first_cmdty = split_cmdty;
|
||||
}
|
||||
|
||||
if (! gnc_commodity_equal(split_cmdty, first_cmdty))
|
||||
if (!gnc_numeric_zero_p(split_amount) &&
|
||||
! gnc_commodity_equal(split_cmdty, first_cmdty))
|
||||
{
|
||||
GncSxVariable *var;
|
||||
GString *var_name;
|
||||
|
@ -608,6 +608,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
|
||||
Account *acct;
|
||||
gnc_commodity *split_cmdty;
|
||||
txnCreditDebitSums *tcds;
|
||||
gnc_numeric split_amount;
|
||||
|
||||
s = (Split*)splitList->data;
|
||||
t = xaccSplitGetParent( s );
|
||||
@ -632,11 +633,14 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
|
||||
acct_guid = kvp_value_get_guid( v );
|
||||
acct = xaccAccountLookup( acct_guid, gnc_get_current_book ());
|
||||
split_cmdty = xaccAccountGetCommodity(acct);
|
||||
if (base_cmdty == NULL)
|
||||
split_amount = xaccSplitGetAmount(s);
|
||||
if (!gnc_numeric_zero_p(split_amount) && base_cmdty == NULL)
|
||||
{
|
||||
base_cmdty = split_cmdty;
|
||||
}
|
||||
multi_commodity |= !gnc_commodity_equal(split_cmdty, base_cmdty);
|
||||
multi_commodity |= (!gnc_numeric_zero_p(split_amount) &&
|
||||
!gnc_commodity_equal(split_cmdty,
|
||||
base_cmdty));
|
||||
|
||||
v = kvp_frame_get_slot_path( f,
|
||||
GNC_SX_ID,
|
||||
@ -792,6 +796,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
|
||||
{
|
||||
gnc_warning_dialog(sxed->dialog, "%s",
|
||||
_("Scheduled Transactions with variables "
|
||||
"or involving more than one commodity "
|
||||
"cannot be automatically created."));
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user