Skip to content
Snippets Groups Projects
Commit 3bb4c0c9 authored by wan's avatar wan
Browse files

[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: default avatarQuentin De Paoli (qdp) <qdp@openerp.com>
parent 1940796d
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
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