diff --git a/default_warehouse_from_sale_team/models/account_move.py b/default_warehouse_from_sale_team/models/account_move.py index eb42941dfe9..9965818233e 100644 --- a/default_warehouse_from_sale_team/models/account_move.py +++ b/default_warehouse_from_sale_team/models/account_move.py @@ -7,7 +7,11 @@ class AccountMove(models.Model): def _search_default_journal(self): """If a team is provided and it has a sales journal set, take it as 1st alternative""" journal = super()._search_default_journal() - team = self.env.context.get("salesteam") or self.team_id or self.env.user.sale_team_id + team = ( + self.env.context.get("salesteam") + or (self._cache["team_id"] and self.team_id) + or self.env.user.sale_team_id + ) journal_on_team = team._get_default_journal([journal.type or "general"]) return journal_on_team or journal