Skip to content

[19.0][FIX] purchase_request: handle False move_dest_ids in procurement values#3097

Open
HviorForgeFlow wants to merge 1 commit into
OCA:19.0from
ForgeFlow:19.0-fix-purchase-request-move-dest-ids
Open

[19.0][FIX] purchase_request: handle False move_dest_ids in procurement values#3097
HviorForgeFlow wants to merge 1 commit into
OCA:19.0from
ForgeFlow:19.0-fix-purchase-request-move-dest-ids

Conversation

@HviorForgeFlow

Copy link
Copy Markdown
Member

Summary

  • dict.get("move_dest_ids", []) only falls back to [] when the key is absent from the dict. Odoo stores empty relational fields as False, so when the key is present with value False the default is bypassed and iterating over False raises TypeError: 'bool' object is not iterable.
  • Fixed by switching to (procurement.values.get("move_dest_ids") or []), which handles both the absent-key and False-value cases — matching the pattern already used by purchase_stock core for the same field.

Fixes #2985

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

@BhaveshHeliconia BhaveshHeliconia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants