From 02b204d408cc7a5aa8aa0d7035c50ecdb42c335d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Tue, 12 Sep 2017 20:58:10 +0200 Subject: [PATCH] GridAccount : set operation as virtual if its account is virtual --- src/view/grid/GridAccount.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 10bf5c8..f3f4ca4 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -932,7 +932,8 @@ void GridAccount::OnOperationModified(int row, int col) Tag tag; bool fix_cost; Operation NULLop; - + Account account; + // Avoid recursives calls if (_inModification || _loadOperations) return; @@ -1058,6 +1059,7 @@ void GridAccount::OnOperationModified(int row, int col) if (value.length()) { new_op.account = user->GetAccountId(value); + account = user->GetAccount(new_op.account); op_complete--; } @@ -1080,7 +1082,7 @@ void GridAccount::OnOperationModified(int row, int col) new_op.meta = cur_op.meta; new_op.parent = cur_op.parent; new_op.childs = cur_op.childs; - new_op._virtual = cur_op._virtual; + new_op._virtual = account._virtual; UpdateOperation(new_op); @@ -1115,7 +1117,7 @@ void GridAccount::OnOperationModified(int row, int col) need_insertion = true; new_op.fix_cost = fix_cost; new_op.meta = false; - new_op._virtual = false; + new_op._virtual = account._virtual; new_op.parent = 0; new_op_id = _kiss->AddOperation(new_op); @@ -1136,7 +1138,7 @@ void GridAccount::OnOperationModified(int row, int col) _transfertCompletionIndex = (_transfertCompletionIndex + 1) % 2; } - if (!new_op.meta && user->GetAccount(new_op.account).blocked && new_op.amount < 0) + if (!new_op.meta && account.blocked && new_op.amount < 0) QMessageBox::warning(0, _("Warning"), _("You made a debit on a blocked account")); if (need_insertion)