Skip to content

Instantly share code, notes, and snippets.

@meepoSenpai
Last active September 18, 2018 12:36
Show Gist options
  • Save meepoSenpai/d6d5dbb43a56e33300e3cf49d16f254d to your computer and use it in GitHub Desktop.
Save meepoSenpai/d6d5dbb43a56e33300e3cf49d16f254d to your computer and use it in GitHub Desktop.
[unique_partners.update([supplier.name for supplier in supplier_info]) for supplier_info in [line.product_id.seller_ids for line in self.order_lines if line.product_id and line.product_id.seller_ids]]
# This small snippet does the exact same task as the following:
for line in self.order_lines:
if line.product_id and line.product_id.seller_ids:
for supplier_info in line.product_id.seller_ids:
unique_partners.update([supplier.name for supplier in supplier_info])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment