From ab1ae1a854eab4a38aa2866bfc9d8ca9aa4013be Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 4 Feb 2020 12:28:18 +0000 Subject: [PATCH] [FIX] account: missing flush() --- addons/account/models/account_move.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 7a0d18c2209..63b7cb0d906 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2318,6 +2318,9 @@ class AccountMove(models.Model): if any(move.type not in ('in_invoice', 'out_invoice') for move in self): raise ValidationError(_("This action isn't available for this document.")) + # this is necessary, go figure why + self.flush() + for move in self: move.type = move.type.replace('invoice', 'refund') reversed_move = move._reverse_move_vals({}, False)