Autosave: 20260209-180113
This commit is contained in:
parent
843c1807e7
commit
80c69b02d2
Binary file not shown.
Binary file not shown.
@ -42,6 +42,7 @@ class Product(models.Model):
|
||||
expiry_date = models.DateField(_("Expiry Date"), null=True, blank=True)
|
||||
image = models.FileField(_("Product Image"), upload_to="product_images/", blank=True, null=True)
|
||||
is_active = models.BooleanField(_("Active"), default=True)
|
||||
is_service = models.BooleanField(_("Is Service"), default=False)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
@ -65,6 +66,7 @@ class Customer(models.Model):
|
||||
address = models.TextField(_("Address"), blank=True)
|
||||
loyalty_points = models.DecimalField(_("Loyalty Points"), max_digits=15, decimal_places=2, default=0)
|
||||
loyalty_tier = models.ForeignKey(LoyaltyTier, on_delete=models.SET_NULL, null=True, blank=True, related_name="customers")
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
@ -95,6 +97,7 @@ class Supplier(models.Model):
|
||||
name = models.CharField(_("Name"), max_length=200)
|
||||
contact_person = models.CharField(_("Contact Person"), max_length=200, blank=True)
|
||||
phone = models.CharField(_("Phone"), max_length=20, blank=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
@ -374,11 +377,10 @@ class PurchaseReturnItem(models.Model):
|
||||
return f"{self.product.name_en} x {self.quantity}"
|
||||
|
||||
class HeldSale(models.Model):
|
||||
customer = models.ForeignKey(Customer, on_delete=models.SET_NULL, null=True, blank=True, related_name="held_sales")
|
||||
cart_data = models.JSONField(_("Cart Data"))
|
||||
total_amount = models.DecimalField(_("Total Amount"), max_digits=15, decimal_places=3)
|
||||
notes = models.TextField(_("Notes"), blank=True)
|
||||
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True, related_name="held_sales")
|
||||
cart_data = models.TextField(_("Cart Data"))
|
||||
customer_name = models.CharField(_("Customer Name"), max_length=200, blank=True)
|
||||
note = models.TextField(_("Note"), blank=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
@ -483,10 +485,10 @@ class CashierSession(models.Model):
|
||||
@receiver(post_save, sender=User)
|
||||
def create_user_profile(sender, instance, created, **kwargs):
|
||||
if created:
|
||||
UserProfile.objects.create(user=instance)
|
||||
UserProfile.objects.get_or_create(user=instance)
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
def save_user_profile(sender, instance, **kwargs):
|
||||
if not hasattr(instance, 'profile'):
|
||||
UserProfile.objects.create(user=instance)
|
||||
UserProfile.objects.get_or_create(user=instance)
|
||||
if hasattr(instance, 'profile'):
|
||||
instance.profile.save()
|
||||
1113
core/views.py
1113
core/views.py
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user