diff --git a/addons/account/wizard/account_validate_account_move.py b/addons/account/wizard/account_validate_account_move.py
index 23ff062a021d1cc2963da3c0ca88da5b742505c0..922f5685a18085523f77fc80d0810bb0ea0a0332 100644
--- a/addons/account/wizard/account_validate_account_move.py
+++ b/addons/account/wizard/account_validate_account_move.py
@@ -9,7 +9,7 @@ class ValidateAccountMove(models.TransientModel):
     def validate_move(self):
         context = dict(self._context or {})
         moves = self.env['account.move'].browse(context.get('active_ids'))
-        move_to_post = moves.filtered(lambda m: m.state == 'draft').sorted(lambda m: (m.date, m.ref, m.id))
+        move_to_post = moves.filtered(lambda m: m.state == 'draft').sorted(lambda m: (m.date, m.ref or '', m.id))
         if not move_to_post:
             raise UserError(_('There are no journal items in the draft state to post.'))
         move_to_post.post()