[FIX] account: Validating a statement with old posted moves

When validating a statement with old posted moves, the lock date
was checked by function, _check_lock_date and then it was impossible
to validate the statement even if all the moves were already posted.

Backport of this commit: 86a0d31251

opw:1830804
This commit is contained in:
Goffin Simon
2018-04-09 14:33:29 +02:00
parent 27162b0e73
commit 026781ec3e
@@ -247,7 +247,7 @@ class AccountBankStatement(models.Model):
raise UserError(_('All the account entries lines must be processed in order to close the statement.'))
moves = (moves | st_line.journal_entry_ids)
if moves:
moves.post()
moves.filtered(lambda m: m.state != 'posted').post()
statement.message_post(body=_('Statement %s confirmed, journal items were created.') % (statement.name,))
statements.link_bank_to_partner()
statements.write({'state': 'confirm', 'date_done': time.strftime("%Y-%m-%d %H:%M:%S")})