diff --git a/api/__pycache__/settings.cpython-312.pyc b/api/__pycache__/settings.cpython-312.pyc index d1ea22b9..616382cf 100644 Binary files a/api/__pycache__/settings.cpython-312.pyc and b/api/__pycache__/settings.cpython-312.pyc differ diff --git a/app/__pycache__/models.cpython-312.pyc b/app/__pycache__/models.cpython-312.pyc index 6f2b86c6..009000fd 100644 Binary files a/app/__pycache__/models.cpython-312.pyc and b/app/__pycache__/models.cpython-312.pyc differ diff --git a/app/migrations/0344_payment_schedule_ovd_days_and_more.py b/app/migrations/0344_payment_schedule_ovd_days_and_more.py new file mode 100644 index 00000000..f9e08d3d --- /dev/null +++ b/app/migrations/0344_payment_schedule_ovd_days_and_more.py @@ -0,0 +1,48 @@ +# Generated by Django 5.1.7 on 2026-01-05 04:52 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0343_import_setting_call_api_delete_payment'), + ] + + operations = [ + migrations.AddField( + model_name='payment_schedule', + name='ovd_days', + field=models.IntegerField(null=True), + ), + migrations.AddField( + model_name='payment_schedule', + name='penalty_amount', + field=models.DecimalField(decimal_places=2, max_digits=15, null=True), + ), + migrations.AddField( + model_name='transaction', + name='amount_remain', + field=models.DecimalField(decimal_places=2, max_digits=15, null=True), + ), + migrations.AddField( + model_name='transaction', + name='ovd_days', + field=models.IntegerField(null=True), + ), + migrations.AddField( + model_name='transaction', + name='penalty_amount', + field=models.DecimalField(decimal_places=2, max_digits=15, null=True), + ), + migrations.AlterField( + model_name='company', + name='code', + field=models.CharField(db_index=True, max_length=20, null=True, unique=True), + ), + migrations.AlterField( + model_name='people', + name='code', + field=models.CharField(db_index=True, max_length=20, null=True, unique=True), + ), + ] diff --git a/app/models.py b/app/models.py index d5dac4cc..bab90530 100644 --- a/app/models.py +++ b/app/models.py @@ -1166,8 +1166,10 @@ class Country(models.Model): db_table = 'country' -class Company(models.Model): - code = models.CharField(max_length=20, null=False, unique=True, db_index=True) +class Company(AutoCodeModel): + code_prefix = "CP" + code_padding = 5 + code = models.CharField(max_length=20, null=True, unique=True, db_index=True) tax_code = models.CharField(max_length=20, null=True, unique=True) fullname = models.CharField(max_length=300, null=False, db_index=True) shortname = models.CharField(max_length=50, null=True, db_index=True) @@ -1188,8 +1190,10 @@ class Company(models.Model): db_table = 'company' -class People(models.Model): - code = models.CharField(max_length=20, null=False, unique=True, db_index=True) +class People(AutoCodeModel): + code_prefix = "RE" + code_padding = 5 + code = models.CharField(max_length=20, null=True, unique=True, db_index=True) fullname = models.CharField(max_length=50, null=False) phone = models.CharField(max_length=20, null=False) email = models.CharField(max_length=100, null=True) @@ -1356,6 +1360,9 @@ class Transaction(AutoCodeModel): deposit_received = models.DecimalField(max_digits=15, decimal_places=2, null=True) deposit_remaining = models.DecimalField(max_digits=15, decimal_places=2, null=True) amount_received = models.DecimalField(max_digits=15, decimal_places=2, null=True) + amount_remain = models.DecimalField(max_digits=15, decimal_places=2, null=True) + ovd_days = models.IntegerField(null=True) + penalty_amount = models.DecimalField(null=True, max_digits=15, decimal_places=2) payment_plan = models.JSONField(null=True) create_time = models.DateTimeField(null=True, auto_now_add=True) update_time = models.DateTimeField(null=True, auto_now=True) @@ -1638,6 +1645,8 @@ class Payment_Schedule(AutoCodeModel): updater = models.ForeignKey(User, null=False, related_name='+', on_delete=models.PROTECT) entry = models.ForeignKey(Internal_Entry, null=True, related_name='+', on_delete=models.PROTECT) detail = models.JSONField(null=True) + ovd_days = models.IntegerField(null=True) + penalty_amount = models.DecimalField(null=True, max_digits=15, decimal_places=2) create_time = models.DateTimeField(null=True, auto_now_add=True) update_time = models.DateTimeField(null=True, auto_now=True) diff --git a/app/test.py b/app/test.py index c5e3d5b2..1bb653f2 100644 --- a/app/test.py +++ b/app/test.py @@ -14,14 +14,9 @@ from django.forms.models import model_to_dict # Customer.objects.exclude(creator__username__in=arr).delete() # File.objects.exclude(user__username__in=arr).delete() # User.objects.exclude(username__in=arr).delete() - - - -Dealer_Setting.objects.all().delete() - -objs = [] -for a in Biz_Setting.objects.all(): - data = model_to_dict(a, exclude=['id']) - objs.append(Dealer_Setting(**data)) - -Dealer_Setting.objects.bulk_create(objs) \ No newline at end of file +# Dealer_Setting.objects.all().delete() +# objs = [] +# for a in Biz_Setting.objects.all(): +# data = model_to_dict(a, exclude=['id']) +# objs.append(Dealer_Setting(**data)) +# Dealer_Setting.objects.bulk_create(objs) \ No newline at end of file