Skip to content
Snippets Groups Projects
Commit 3549688b authored by Cédric Snauwaert's avatar Cédric Snauwaert
Browse files

[FIX] account: fix reconciliation that create double entries in some case

commit 2f3b469d fixes a problem
where open balance had to be added in the lines to create,
however in the case where no line is selected, a new one is created automatically
(for usability purpose) and the balance was not update correctly,
resulting in the creation of a double entry.
parent e6146db8
No related branches found
No related tags found
No related merge requests found
......@@ -602,9 +602,14 @@ var StatementModel = BasicModel.extend({
var line = self.getLine(handle);
var props = _.filter(line.reconciliation_proposition, function (prop) {return !prop.is_tax && !prop.invalid;});
if (props.length === 0) {
// Usability: if user has not choosen any lines and click validate, it has the same behavior
// as creating a write-off of the same amount.
props.push(self._formatQuickCreate(line, {
account_id: [line.st_line.open_balance_account_id, self.accounts[line.st_line.open_balance_account_id]],
}));
// update balance of line otherwise it won't be to zero and another line will be added
line.reconciliation_proposition.push(props[0]);
self._computeLine(line);
}
ids.push(line.id);
var values_dict = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment