[19.0][FIX] purchase_request: handle False move_dest_ids in procurement values#3097
Open
HviorForgeFlow wants to merge 1 commit into
Open
[19.0][FIX] purchase_request: handle False move_dest_ids in procurement values#3097HviorForgeFlow wants to merge 1 commit into
HviorForgeFlow wants to merge 1 commit into
Conversation
dict.get("key", []) only falls back to [] when the key is absent; Odoo
stores empty relational fields as False, so the default is bypassed and
iterating over False raises TypeError. Use `or []` instead, matching the
pattern used by purchase_stock core for the same field.
Fixes OCA#2985
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dict.get("move_dest_ids", [])only falls back to[]when the key is absent from the dict. Odoo stores empty relational fields asFalse, so when the key is present with valueFalsethe default is bypassed and iterating overFalseraisesTypeError: 'bool' object is not iterable.(procurement.values.get("move_dest_ids") or []), which handles both the absent-key andFalse-value cases — matching the pattern already used bypurchase_stockcore for the same field.Fixes #2985