Skip to content

Commit

Permalink
Merge pull request #6 from muchdogesec/product-signal-fix
Browse files Browse the repository at this point in the history
Fix 'no matching price' error while trying to sync product
  • Loading branch information
himynamesdave authored Dec 6, 2024
2 parents 026f9ce + 7c13bf4 commit 25476cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/teams/receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@ def handle_subscription_pre_save(sender, signal, instance, **kwargs):

@receiver(pre_save, sender=Product)
def handle_product_pre_save(sender, signal, instance, **kwargs):
old_product = Product.objects.get(id=instance.id)
old_product = Product.objects.filter(id=instance.id).first()
if not old_product:
return
save_product_allowed_feeds_value(old_product.id, old_product.metadata.get('allowed_api_access'))

@receiver(post_save, sender=Product)
def handle_product_post_save(sender, signal, instance, **kwargs):
if instance.metadata.get('allowed_api_access') == 'true':
return
old_value = get_product_allowed_feeds_value(instance.id)
if not old_value:
return
allowed_api_access = instance.metadata.get('allowed_api_access')
if allowed_api_access == 'true':
return
Expand Down

0 comments on commit 25476cf

Please sign in to comment.