Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix 603: scheduled transactions with multiple splits end up going to imbalance #628

Closed
wants to merge 2 commits into from

Conversation

pnemonic78
Copy link
Contributor

Template transactions have splits with zero quantities but non-zero values.
The quantity's currency might be different than the value's currency.

moshe.w@invest.com added 2 commits December 13, 2016 12:00
…alues. The quantity's currency might be different than the value's currency.
@@ -268,7 +268,11 @@ public Money getBalance(String accountUID){
public Money getImbalance(){
Money imbalance = Money.createZeroInstance(mCurrencyCode);
for (Split split : mSplitList) {
if (!split.getQuantity().getCommodity().getCurrencyCode().equals(mCurrencyCode)) {
Money quantity = split.getQuantity();
if (quantity.isAmountZero()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say quantity should never be zero (see this comment). Am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing the fact that template transactions have splits with zero quantity, but non-zero values.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which case would we have a valid template transaction with zero quantity and non-zero value? It doesn't seem possible from the Android application. How do you create such template transaction?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it happens when importing from Desktop.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it's an import problem that should be fixed instead of worked around.

Split imbSplit = mTransaction.createAutoBalanceSplit();
if (imbSplit != null) {
mAutoBalanceSplits.add(imbSplit);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we get a transaction with unbalanced splits (scheduled or normal), I'd say it's either we've failed to import it correctly or there's something wrong in the file.

@rivaldi8
Copy link
Collaborator

Sorry, I can merge these changes. They are working around the problem instead of fixing it.

@rivaldi8 rivaldi8 closed this Jan 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants