diff --git a/account_move_export/models/account_move_export.py b/account_move_export/models/account_move_export.py index bcfd999..4e57eeb 100644 --- a/account_move_export/models/account_move_export.py +++ b/account_move_export/models/account_move_export.py @@ -505,7 +505,10 @@ def _csv_encode(self, tmpfile): def get_moves(self): self.ensure_one() - assert self.filter_type == "custom" + assert self.filter_type == 'custom' + previous_moves = self.env["account.move"].search([("account_move_export_id", "=", self.id)]) + if previous_moves: + previous_moves.write({'account_move_export_id': False}) domain = self._prepare_custom_filter_domain() moves = self.env["account.move"].search(domain) if not moves: