diff --git a/.gitignore b/.gitignore index e427ff3..f874c48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,12 @@ node_modules/ */node_modules/ */build/ +.env +db.sqlite3 +media/ +staticfiles/ +__pycache__/ +*.pyc +.DS_Store +*.log +tmp/ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index f74068e..05112f9 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 14d2920..43fa783 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/migrations/0036_alter_systemsetting_options.py b/core/migrations/0036_alter_systemsetting_options.py new file mode 100644 index 0000000..fac0542 --- /dev/null +++ b/core/migrations/0036_alter_systemsetting_options.py @@ -0,0 +1,17 @@ +# Generated by Django 5.2.7 on 2026-02-11 16:22 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0035_remove_heldsale_customer_remove_heldsale_notes_and_more'), + ] + + operations = [ + migrations.AlterModelOptions( + name='systemsetting', + options={'permissions': [('view_dashboard', 'Can view dashboard'), ('view_pos', 'Can access POS'), ('view_reports', 'Can view reports'), ('view_accounting', 'Can view accounting'), ('view_hr', 'Can view HR')]}, + ), + ] diff --git a/core/migrations/0037_alter_systemsetting_options.py b/core/migrations/0037_alter_systemsetting_options.py new file mode 100644 index 0000000..6b9329e --- /dev/null +++ b/core/migrations/0037_alter_systemsetting_options.py @@ -0,0 +1,17 @@ +# Generated by Django 5.2.7 on 2026-02-11 16:26 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0036_alter_systemsetting_options'), + ] + + operations = [ + migrations.AlterModelOptions( + name='systemsetting', + options={'permissions': [('view_dashboard', 'Can view dashboard'), ('view_pos', 'Can access POS'), ('view_reports', 'Can view reports'), ('view_accounting', 'Can view accounting'), ('view_hr', 'Can view HR'), ('view_inventory', 'Can view inventory'), ('view_sales', 'Can view sales'), ('view_purchases', 'Can view purchases'), ('view_customers', 'Can view customers'), ('view_suppliers', 'Can view suppliers'), ('view_expenses', 'Can view expenses'), ('view_lpo', 'Can view LPO'), ('view_quotations', 'Can view quotations')]}, + ), + ] diff --git a/core/models.py b/core/models.py index c9b2133..f8a7dc0 100644 --- a/core/models.py +++ b/core/models.py @@ -398,6 +398,21 @@ class SystemSetting(models.Model): favicon = models.FileField(_("Favicon"), upload_to="business_logos/", blank=True, null=True) vat_number = models.CharField(_("VAT Number"), max_length=50, blank=True) registration_number = models.CharField(_("Registration Number"), max_length=50, blank=True) + + # Loyalty Settings + loyalty_enabled = models.BooleanField(_("Enable Loyalty System"), default=False) + points_per_currency = models.DecimalField(_("Points Earned per Currency Unit"), max_digits=10, decimal_places=2, default=1.0) + currency_per_point = models.DecimalField(_("Currency Value per Point"), max_digits=10, decimal_places=3, default=0.01) + min_points_to_redeem = models.PositiveIntegerField(_("Minimum Points to Redeem"), default=100) + + # WhatsApp Gateway (Wablas) + wablas_enabled = models.BooleanField(_("Enable WhatsApp Gateway"), default=False) + wablas_server_url = models.URLField(_("Wablas Server URL"), blank=True, help_text=_("Example: https://console.wablas.com")) + wablas_token = models.CharField(_("Wablas API Token"), max_length=255, blank=True) + wablas_secret_key = models.CharField(_("Wablas Secret Key"), max_length=255, blank=True) + + # POS Settings + allow_zero_stock_sales = models.BooleanField(_("Allow selling items with 0 stock"), default=False) class Meta: permissions = [ @@ -406,6 +421,14 @@ class SystemSetting(models.Model): ("view_reports", "Can view reports"), ("view_accounting", "Can view accounting"), ("view_hr", "Can view HR"), + ("view_inventory", "Can view inventory"), + ("view_sales", "Can view sales"), + ("view_purchases", "Can view purchases"), + ("view_customers", "Can view customers"), + ("view_suppliers", "Can view suppliers"), + ("view_expenses", "Can view expenses"), + ("view_lpo", "Can view LPO"), + ("view_quotations", "Can view quotations"), ] def __str__(self): diff --git a/core/templates/base.html b/core/templates/base.html index 3313009..1939b64 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -64,11 +64,14 @@
@@ -99,11 +107,14 @@ @@ -134,6 +146,7 @@ @@ -155,6 +168,7 @@ @@ -175,21 +190,24 @@ - {% if user.is_superuser or user.is_staff %} - + {% if user.is_staff or perms.core.view_accounting %}