ob-dj-store 0.0.21.4__py3-none-any.whl → 0.0.21.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -250,10 +250,16 @@ class Product(DjangoModelCleanMixin, models.Model):
250
250
 
251
251
  def get_inventory(self, store_id):
252
252
  try:
253
- inventory = self.product_variants.first().inventories.get(store_id=store_id)
253
+ # Prefer the primary variant if available
254
+ product_variant = (
255
+ self.product_variants.filter(inventories__is_primary=True).first()
256
+ or self.product_variants.first()
257
+ )
258
+ if not product_variant:
259
+ return None
260
+ return product_variant.inventories.get(store_id=store_id)
254
261
  except ObjectDoesNotExist:
255
262
  return None
256
- return inventory
257
263
 
258
264
  def is_snoozed(self, store_id):
259
265
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ob-dj-store
3
- Version: 0.0.21.4
3
+ Version: 0.0.21.5
4
4
  Summary: OBytes django application for managing ecommerce stores.
5
5
  Home-page: https://www.obytes.com/
6
6
  Author: OBytes
@@ -153,14 +153,14 @@ ob_dj_store/core/stores/models/_inventory.py,sha256=_rGlVL5HjOlHQVB8CI0776CPcE5r
153
153
  ob_dj_store/core/stores/models/_order.py,sha256=_08lqX5p4brCdUilqfbT--6Ao2TMsqnzXaWoV_7IYL8,9758
154
154
  ob_dj_store/core/stores/models/_partner.py,sha256=OuYvevUWn1sYHs9PcFf51EUUC1uqytQss8Bx91aMOH8,4732
155
155
  ob_dj_store/core/stores/models/_payment.py,sha256=FTV-NmvQjxwwR5C5X7qYWV-ZUIZfqMMEjkBNaS-drLs,6421
156
- ob_dj_store/core/stores/models/_product.py,sha256=cYMsCtcYoJJ-kdmDmHGm2AGBo2cn6qWuF9g7zQJ_p2g,18283
156
+ ob_dj_store/core/stores/models/_product.py,sha256=KUi2hkA4VNCrWwWp3AM_tkubFptpOdiFt0Twzi2wW14,18535
157
157
  ob_dj_store/core/stores/models/_store.py,sha256=0K-CNJWuXNqeyULL1J0M9hiNcVla0UNNjdCdN_nzNEE,9833
158
158
  ob_dj_store/core/stores/models/_wallet.py,sha256=YvT-rvED-jrYjePLJpvdLXXoBudR6TGPu5cNE0m2fWo,5643
159
159
  ob_dj_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
160
160
  ob_dj_store/utils/helpers.py,sha256=o7wgypM7mI2vZqZKkhxnTcnHJC8GMQDOuYMnRwXr6tY,2058
161
161
  ob_dj_store/utils/model.py,sha256=DV7hOhTaZL3gh9sptts2jTUFlTArKG3i7oPioq9HLFE,303
162
162
  ob_dj_store/utils/utils.py,sha256=8UVAFB56qUSjJJ5f9vnermtw638gdFy4CFRCuMbns_M,1342
163
- ob_dj_store-0.0.21.4.dist-info/METADATA,sha256=qhdG-tlBDz4MV9ybB8VQwDWe5t-2eKMTacinZNLizjo,2850
164
- ob_dj_store-0.0.21.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
165
- ob_dj_store-0.0.21.4.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
166
- ob_dj_store-0.0.21.4.dist-info/RECORD,,
163
+ ob_dj_store-0.0.21.5.dist-info/METADATA,sha256=K_XMw3wkfDg8n81xaZl2MErFWttOueqlGJqzuf_7pfQ,2850
164
+ ob_dj_store-0.0.21.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
165
+ ob_dj_store-0.0.21.5.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
166
+ ob_dj_store-0.0.21.5.dist-info/RECORD,,