[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#43674 X-original-commit: 3bb4c0c99b29bb85916af95361b86e9dc3287546 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user