Fixes: 1) Correct iteration over related objects in fix_prices command using .all() instead of direct access;

Extra: None;
This commit is contained in:
Egor Pavlovich Gorbunov 2025-06-17 11:17:40 +03:00
parent 6ee3870ab0
commit 0f65111b53

View file

@ -13,7 +13,7 @@ class Command(BaseCommand):
self.stdout.write(self.style.SUCCESS("Starting fixing stocks' prices...")) self.stdout.write(self.style.SUCCESS("Starting fixing stocks' prices..."))
for product in Product.objects.filter(stocks__isnull=False): for product in Product.objects.filter(stocks__isnull=False):
for stock in product.stocks: for stock in product.stocks.all():
try: try:
stock.price = AbstractVendor.round_price_marketologically(stock.price) stock.price = AbstractVendor.round_price_marketologically(stock.price)
stock.save() stock.save()