ob-dj-store 0.0.20__py3-none-any.whl → 0.0.20.1__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.
@@ -453,12 +453,15 @@ class OrderSerializer(serializers.ModelSerializer):
453
453
  raise ValidationError(_("You cannot order from different stores"))
454
454
  for item in user.cart.items.all():
455
455
  if item.inventory:
456
- if (
457
- not item.inventory.is_uncountable
458
- and not item.inventory.quantity
459
- or item.inventory.quantity == 0
460
- ):
456
+ if item.inventory.is_snoozed:
461
457
  unavailable_items.append(item)
458
+ elif not item.inventory.is_uncountable:
459
+ if (
460
+ not item.inventory.quantity
461
+ or item.inventory.quantity == 0
462
+ ):
463
+ unavailable_items.append(item)
464
+
462
465
  elif not item.inventory:
463
466
  if language and item.product_variant.product.name_arabic:
464
467
  product_name = item.product_variant.product.name_arabic
@@ -848,10 +851,19 @@ class CartSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
848
851
  # update or create instance items
849
852
  for item in validated_data["items"]:
850
853
  attribute_choices = item.pop("attribute_choices", None)
851
- cart_item = CartItem.objects.create(
854
+ logger.info("cart item :", item)
855
+ cart_item, created = CartItem.objects.get_or_create(
852
856
  cart=instance,
853
- **item,
857
+ pk=item.pop("id", None),
858
+ defaults={
859
+ "cart": instance,
860
+ "product_variant": item.pop("product_variant", None),
861
+ "store": item.pop("store", None),
862
+ "notes": item.pop("notes", None),
863
+ "quantity": item.pop("quantity", None),
864
+ },
854
865
  )
866
+
855
867
  if attribute_choices:
856
868
  cart_item.attribute_choices.set(attribute_choices)
857
869
  cart_item.save()
@@ -1425,7 +1437,7 @@ class FavoriteSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
1425
1437
  else:
1426
1438
  if inventory.is_uncountable:
1427
1439
  return True
1428
- return inventory.quantity > 0
1440
+ return False
1429
1441
  except ObjectDoesNotExist:
1430
1442
  return False
1431
1443
  return None
@@ -288,6 +288,7 @@ class CartAdmin(admin.ModelAdmin):
288
288
  search_fields = [
289
289
  "customer__email",
290
290
  ]
291
+ autocomplete_fields = ["customer"]
291
292
 
292
293
  def get_queryset(self, request):
293
294
  queryset = super().get_queryset(request)
@@ -380,6 +381,7 @@ class OrderAdmin(ImportExportModelAdmin, admin.ModelAdmin):
380
381
  "status",
381
382
  WeekNumberFilter, # Include the filter instance instead of the class name
382
383
  ]
384
+ autocomplete_fields = ["customer"]
383
385
 
384
386
  def get_queryset(self, request):
385
387
  queryset = (
@@ -419,6 +421,7 @@ class PaymentAdmin(ImportExportModelAdmin, admin.ModelAdmin):
419
421
  search_fields = ["orders__store__name", "user__email"]
420
422
  readonly_fields = ("orders",)
421
423
  date_hierarchy = "created_at"
424
+ autocomplete_fields = ["user"]
422
425
 
423
426
 
424
427
  class InventoryAdmin(admin.ModelAdmin):
@@ -107,12 +107,7 @@ class CartItemInlineAdmin(admin.TabularInline):
107
107
  class OrderItemInline(admin.TabularInline):
108
108
  model = models.OrderItem
109
109
  extra = 0
110
- fields = (
111
- "product_variant",
112
- "quantity",
113
- "unit_value",
114
- "total_amount",
115
- )
110
+ fields = ("product_variant", "quantity", "unit_value", "total_amount", "notes")
116
111
  readonly_fields = (
117
112
  "unit_value",
118
113
  "total_amount",
@@ -97,7 +97,8 @@ class Cart(models.Model):
97
97
  def fill(self, order):
98
98
  from ob_dj_store.core.stores.models._cart import CartItem
99
99
 
100
- for item in order.items.all():
100
+ order_items = order.items.all()
101
+ for item in order_items:
101
102
  cart_item = CartItem.objects.create(
102
103
  cart=self,
103
104
  product_variant=item.product_variant,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ob-dj-store
3
- Version: 0.0.20
3
+ Version: 0.0.20.1
4
4
  Summary: OBytes django application for managing ecommerce stores.
5
5
  Home-page: https://www.obytes.com/
6
6
  Author: OBytes
@@ -3,15 +3,15 @@ ob_dj_store/apis/stores/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
3
3
  ob_dj_store/apis/stores/filters.py,sha256=zKBXPBoqIyFlSeZOECp97RTWvSLqNPnlPhEp7p8W5tE,9702
4
4
  ob_dj_store/apis/stores/urls.py,sha256=7vwogfIGcKS0hHYK3iBXKQwi1kCA_vuHY1eZt8rAspg,2021
5
5
  ob_dj_store/apis/stores/views.py,sha256=aE4LFPHzs_CtzZ8K5-vAbDn_51hyhi0KIsi7cV8dpkA,43372
6
- ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=IRpWBlEdbPCOX7FnVwxJhq4dXLOB8IcToLK7RM6HxI4,65258
6
+ ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=sSUPSKYykXRI63FZzOggO90XWLDuKR-icjRIakAc318,65778
7
7
  ob_dj_store/apis/tap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  ob_dj_store/apis/tap/serializers.py,sha256=KPrBK4h2-fWvEVf6vOj2ww5-USV9WqpyYicIqoHIiXI,1065
9
9
  ob_dj_store/apis/tap/urls.py,sha256=bnOTv6an11kxpo_FdqlhsizlGPLVpNxBjCyKcf3_C9M,367
10
10
  ob_dj_store/apis/tap/views.py,sha256=vG0rC-PQHCnrbNsPW1gClx0rkaIjALEAuj5cQKmCTo0,2664
11
11
  ob_dj_store/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  ob_dj_store/core/stores/__init__.py,sha256=-izNGrxNn_nn3IQXd5pkuES9lSF-AHYb14yhNPozYCI,65
13
- ob_dj_store/core/stores/admin.py,sha256=GWFVIzP4pUjY-57QBXrIhbK27JlY6EDatqsM97sGtZo,14533
14
- ob_dj_store/core/stores/admin_inlines.py,sha256=2K8iDmP4h0CLIOqy3x-ZXXpgYnT2jqL4cg5YFdiho8s,2976
13
+ ob_dj_store/core/stores/admin.py,sha256=IbkkC8ILwFDzWD1vxNfBwRpbSm4fGZOR8yya-ZbSJho,14646
14
+ ob_dj_store/core/stores/admin_inlines.py,sha256=2EOyWvl5ebm9kxHB8HXixAzUSx7FpGubPTwxGEJ66E0,2946
15
15
  ob_dj_store/core/stores/apps.py,sha256=ZadmEER_dNcQTH617b3fAsYZJSyRw0g46Kjp4eOAsOU,498
16
16
  ob_dj_store/core/stores/managers.py,sha256=lz2CE4PJCI1ViO-CU61LqTr43O41aGRQkbWZUR5Fmfg,9909
17
17
  ob_dj_store/core/stores/receivers.py,sha256=DljYC97C_e1mHduKw9Un6YQmxIdwSIter7yVVZwggFA,3768
@@ -141,7 +141,7 @@ ob_dj_store/core/stores/migrations/0105_store_is_open_after_midnight.py,sha256=8
141
141
  ob_dj_store/core/stores/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
142
142
  ob_dj_store/core/stores/models/__init__.py,sha256=VeWrDiIbw94ZDSFD-62rz9iTTW87iPdwDW5jcjxm7bs,2045
143
143
  ob_dj_store/core/stores/models/_address.py,sha256=8zV444A8M7P8yqQHjEOCROUykWPQ1ndSdd2IIX8wwWY,2207
144
- ob_dj_store/core/stores/models/_cart.py,sha256=uImY_F9buKwIQeokl8sooT_AzXHnhD_VFEqmP3Fph2Q,7461
144
+ ob_dj_store/core/stores/models/_cart.py,sha256=UKN_rBf9G0RAe5C1JplnEi6zTtc5toB-Dsq5Xl0rvN4,7495
145
145
  ob_dj_store/core/stores/models/_favorite.py,sha256=3yyMCoiftGOPAQwkMI2J29r3x6NJsRYri9f8gXiF1e8,3306
146
146
  ob_dj_store/core/stores/models/_feedback.py,sha256=eCUVgprNK5hSRKOS4M_pdR7QH2-rqhoYevlpykhCOLg,1472
147
147
  ob_dj_store/core/stores/models/_inventory.py,sha256=ZU8xDMQZxLnFehkBEGWr-os4AF1IlCn5XnBxvRq9IAs,4314
@@ -155,7 +155,7 @@ ob_dj_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
155
155
  ob_dj_store/utils/helpers.py,sha256=o7wgypM7mI2vZqZKkhxnTcnHJC8GMQDOuYMnRwXr6tY,2058
156
156
  ob_dj_store/utils/model.py,sha256=DV7hOhTaZL3gh9sptts2jTUFlTArKG3i7oPioq9HLFE,303
157
157
  ob_dj_store/utils/utils.py,sha256=8UVAFB56qUSjJJ5f9vnermtw638gdFy4CFRCuMbns_M,1342
158
- ob_dj_store-0.0.20.dist-info/METADATA,sha256=GYWfTNybLOa88W3nVp6a8hrulcHsuT65w1Iw61RNR4M,2825
159
- ob_dj_store-0.0.20.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
160
- ob_dj_store-0.0.20.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
161
- ob_dj_store-0.0.20.dist-info/RECORD,,
158
+ ob_dj_store-0.0.20.1.dist-info/METADATA,sha256=nBBXBojt2bOmP9ckG1-VbM4TQcBBh1FzEw5Zxh9LSq0,2827
159
+ ob_dj_store-0.0.20.1.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
160
+ ob_dj_store-0.0.20.1.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
161
+ ob_dj_store-0.0.20.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5