File tree Expand file tree Collapse file tree
androidTest/java/org/gnucash/android/test/ui
main/java/org/gnucash/android/ui/transaction Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -309,8 +309,6 @@ public void testAddMultiCurrencyTransaction(){
309309 Espresso .closeSoftKeyboard ();
310310 onView (withId (R .id .btn_save )).perform (click ());
311311
312- onView (withId (R .id .menu_save )).perform (click ());
313-
314312 List <Transaction > allTransactions = mTransactionsDbAdapter .getAllTransactionsForAccount (TRANSACTIONS_ACCOUNT_UID );
315313 assertThat (allTransactions ).hasSize (transactionCount +1 );
316314 Transaction multiTrans = allTransactions .get (0 );
Original file line number Diff line number Diff line change @@ -235,6 +235,13 @@ public class TransactionFormFragment extends Fragment implements
235235
236236 private boolean mEditMode = false ;
237237
238+ /**
239+ * Flag which is set if another action is triggered during a transaction save (which interrrupts the save process).
240+ * Allows the fragment to check and resume the save operation.
241+ * Primarily used for multicurrency transactions when the currency transfer dialog is opened during save
242+ */
243+ private boolean onSaveAttempt = false ;
244+
238245 /**
239246 * Split quantity which will be set from the funds transfer dialog
240247 */
@@ -828,6 +835,7 @@ private void saveNewTransaction() {
828835 //determine whether we need to do currency conversion
829836
830837 if (isMultiCurrencyTransaction () && !splitEditorUsed () && !mCurrencyConversionDone ){
838+ onSaveAttempt = true ;
831839 startTransferFunds ();
832840 return ;
833841 }
@@ -1034,6 +1042,11 @@ public static String stripCurrencyFormatting(String s){
10341042 public void transferComplete (Money amount ) {
10351043 mCurrencyConversionDone = true ;
10361044 mSplitQuantity = amount ;
1045+
1046+ //The transfer dialog was called while attempting to save. So try saving again
1047+ if (onSaveAttempt )
1048+ saveNewTransaction ();
1049+ onSaveAttempt = false ;
10371050 }
10381051
10391052 @ Override
You can’t perform that action at this time.
0 commit comments