From 3bb4c0c99b29bb85916af95361b86e9dc3287546 Mon Sep 17 00:00:00 2001 From: wan <wan@odoo.com> Date: Fri, 3 Jan 2020 15:45:16 +0000 Subject: [PATCH] [FIX] account: multi-post order compare bool and str The `ref` field on `account.move` is not required and can yield a falsy value. This produces a TypeError while doing the comparison in sorted(). closes #42434 closes odoo/odoo#42708 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com> --- addons/account/wizard/account_validate_account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/wizard/account_validate_account_move.py b/addons/account/wizard/account_validate_account_move.py index 23ff062a021d..922f5685a180 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() -- GitLab