GridAccount : set operation as virtual if its account is virtual

This commit is contained in:
Grégory Soutadé 2017-09-12 20:58:10 +02:00
parent 53cf28e397
commit 02b204d408

View File

@ -932,6 +932,7 @@ void GridAccount::OnOperationModified(int row, int col)
Tag tag; Tag tag;
bool fix_cost; bool fix_cost;
Operation NULLop; Operation NULLop;
Account account;
// Avoid recursives calls // Avoid recursives calls
if (_inModification || _loadOperations) return; if (_inModification || _loadOperations) return;
@ -1058,6 +1059,7 @@ void GridAccount::OnOperationModified(int row, int col)
if (value.length()) if (value.length())
{ {
new_op.account = user->GetAccountId(value); new_op.account = user->GetAccountId(value);
account = user->GetAccount(new_op.account);
op_complete--; op_complete--;
} }
@ -1080,7 +1082,7 @@ void GridAccount::OnOperationModified(int row, int col)
new_op.meta = cur_op.meta; new_op.meta = cur_op.meta;
new_op.parent = cur_op.parent; new_op.parent = cur_op.parent;
new_op.childs = cur_op.childs; new_op.childs = cur_op.childs;
new_op._virtual = cur_op._virtual; new_op._virtual = account._virtual;
UpdateOperation(new_op); UpdateOperation(new_op);
@ -1115,7 +1117,7 @@ void GridAccount::OnOperationModified(int row, int col)
need_insertion = true; need_insertion = true;
new_op.fix_cost = fix_cost; new_op.fix_cost = fix_cost;
new_op.meta = false; new_op.meta = false;
new_op._virtual = false; new_op._virtual = account._virtual;
new_op.parent = 0; new_op.parent = 0;
new_op_id = _kiss->AddOperation(new_op); new_op_id = _kiss->AddOperation(new_op);
@ -1136,7 +1138,7 @@ void GridAccount::OnOperationModified(int row, int col)
_transfertCompletionIndex = (_transfertCompletionIndex + 1) % 2; _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")); QMessageBox::warning(0, _("Warning"), _("You made a debit on a blocked account"));
if (need_insertion) if (need_insertion)