diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index f34b198..9998128 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 09e0de8..7d3121c 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 82f9e48..97afd4a 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/migrations/0013_heldsale.py b/core/migrations/0013_heldsale.py new file mode 100644 index 0000000..3850c0a --- /dev/null +++ b/core/migrations/0013_heldsale.py @@ -0,0 +1,28 @@ +# Generated by Django 5.2.7 on 2026-02-02 16:38 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0012_systemsetting_decimal_places'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='HeldSale', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('cart_data', models.JSONField(verbose_name='Cart Data')), + ('total_amount', models.DecimalField(decimal_places=3, max_digits=15, verbose_name='Total Amount')), + ('notes', models.TextField(blank=True, verbose_name='Notes')), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='held_sales', to=settings.AUTH_USER_MODEL)), + ('customer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='held_sales', to='core.customer')), + ], + ), + ] diff --git a/core/migrations/__pycache__/0013_heldsale.cpython-311.pyc b/core/migrations/__pycache__/0013_heldsale.cpython-311.pyc new file mode 100644 index 0000000..6e6f10f Binary files /dev/null and b/core/migrations/__pycache__/0013_heldsale.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 09650ba..71a240b 100644 --- a/core/models.py +++ b/core/models.py @@ -268,6 +268,17 @@ class PurchaseReturnItem(models.Model): def __str__(self): 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") + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"Held Sale #{self.id} - {self.created_at.strftime('%Y-%m-%d %H:%M')}" + class SystemSetting(models.Model): business_name = models.CharField(_("Business Name"), max_length=200, default="Meezan Accounting") address = models.TextField(_("Address"), blank=True) @@ -281,4 +292,4 @@ class SystemSetting(models.Model): registration_number = models.CharField(_("Registration Number"), max_length=50, blank=True) def __str__(self): - return self.business_name + return self.business_name \ No newline at end of file diff --git a/core/templates/core/inventory.html b/core/templates/core/inventory.html index 8f20e80..265af33 100644 --- a/core/templates/core/inventory.html +++ b/core/templates/core/inventory.html @@ -78,7 +78,7 @@ @@ -118,13 +118,14 @@ {% endif %}
{{ product.sku }}{{ site_settings.currency_symbol }}{{ product.price|floatformat:decimal_places }}
{% trans "Stock" %}: {{ product.stock_quantity }} @@ -161,9 +165,15 @@