Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] default_warehouse_from_sale_team: validate cache access when no record exists i#28375 #1688

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions default_warehouse_from_sale_team/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ def _search_default_journal(self):
journal = super()._search_default_journal()
team = (
self.env.context.get("salesteam")
# If the team_id value (ID) is in the cache, it must be converted to a record from the
# cached value to avoid triggering the field's compute method when it has not yet been computed.
or self._fields["team_id"].convert_to_record(self._cache.get("team_id"), self)
# If the team_id value (ID) is in the cache on a existing account.move record, it must be
# converted to a record from the cached value to avoid triggering the field's compute
# method when it has not yet been computed.
or (self and self._fields["team_id"].convert_to_record(self._cache.get("team_id"), self))
or self.env.user.sale_team_id
)
journal_on_team = team._get_default_journal([journal.type or "general"])
Expand Down
Loading