From b8b45c0aba64726b1fe681c832f228be6abf7543 Mon Sep 17 00:00:00 2001 From: Jorge Che Date: Thu, 20 Oct 2022 00:30:50 +0000 Subject: [PATCH] [FIX] account_exception: do not use ensure_one() on post H11044 --- account_exception/models/account_move.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/account_exception/models/account_move.py b/account_exception/models/account_move.py index 14a3de60..1025b7f2 100644 --- a/account_exception/models/account_move.py +++ b/account_exception/models/account_move.py @@ -32,7 +32,13 @@ class AccountMove(models.Model): return self.env.ref('account_exception.action_account_move_exception_confirm') def action_post(self): - self.ensure_one() - if self.detect_exceptions(): - return self._popup_exceptions() - return super().action_post() + if len(self) == 1: + if self.detect_exceptions(): + return self._popup_exceptions() + else: + return super().action_post() + else: + moves_with_exceptions = self.filtered(lambda m: m.detect_exceptions()) + other_moves = self - moves_with_exceptions + return super(AccountMove, other_moves).action_post() + return False