Do not fetch Shopify locations without session parameters

Closes #13888
(grafted from 667e32ccbbeef4976117078240b1b98cf20e3449)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2025-02-25 16:19:53 +01:00
1 parent 22bedb2c79
commit faf3bc3966
1 file changed
+4 -1
+4 -1
View File
@@ -3,6 +3,7 @@
import datetime as dt
import urllib.parse
from decimal import Decimal
from operator import attrgetter
import pyactiveresource
import shopify
@@ -651,7 +652,9 @@ class Shop_Warehouse(ModelView, metaclass=PoolMeta):
'_parent_shop.shopify_password')
def get_shopify_locations(self):
locations = [(None, "")]
if self.shop:
session = attrgetter(
'shopify_url', 'shopify_version', 'shopify_password')
if self.shop and all(session(self.shop)):
locations_cache = self._shopify_locations_cache.get(self.shop.id)
if locations_cache is not None:
return locations_cache