[FIX] account_exception: do not use ensure_one() on post

H11044
This commit is contained in:
Jorge Che
2022-10-20 00:30:50 +00:00
parent ecf2022c10
commit b8b45c0aba

View File

@@ -32,7 +32,13 @@ class AccountMove(models.Model):
return self.env.ref('account_exception.action_account_move_exception_confirm') return self.env.ref('account_exception.action_account_move_exception_confirm')
def action_post(self): def action_post(self):
self.ensure_one() if len(self) == 1:
if self.detect_exceptions(): if self.detect_exceptions():
return self._popup_exceptions() return self._popup_exceptions()
else:
return super().action_post() 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