This commit is contained in:
anhduy-tech
2026-01-27 12:05:37 +07:00
parent 3d13fbd1f8
commit 9a01afd1c6
8 changed files with 262 additions and 34 deletions

View File

@@ -0,0 +1,19 @@
# Generated by Django 5.1.7 on 2026-01-27 02:45
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0368_dealer_count_sale'),
]
operations = [
migrations.AlterField(
model_name='internal_entry',
name='customer',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='entrycus', to='app.customer'),
),
]

View File

@@ -0,0 +1,27 @@
# Generated by Django 5.1.7 on 2026-01-27 03:02
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0369_alter_internal_entry_customer'),
]
operations = [
migrations.CreateModel(
name='Transaction_Gift',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_time', models.DateTimeField(auto_now_add=True, null=True)),
('update_time', models.DateTimeField(auto_now=True, null=True)),
('gift', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='app.gift')),
('transaction', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='txngift', to='app.transaction')),
],
options={
'db_table': 'transaction_gift',
},
),
]

View File

@@ -0,0 +1,173 @@
# Generated by Django 5.1.7 on 2026-01-27 04:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0370_transaction_gift'),
]
operations = [
migrations.AlterField(
model_name='dealer',
name='commission_amount',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='dealer',
name='commission_remain',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='dealer',
name='pay_commission',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='dealer',
name='pay_sale',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='dealer',
name='sale_amount',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='internal_entry',
name='allocation_amount',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='payment_schedule',
name='amount',
field=models.DecimalField(decimal_places=2, max_digits=35),
),
migrations.AlterField(
model_name='payment_schedule',
name='paid_amount',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='payment_schedule',
name='penalty_amount',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='payment_schedule',
name='penalty_paid',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='payment_schedule',
name='penalty_reduce',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='payment_schedule',
name='remain_amount',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='product',
name='building_area',
field=models.DecimalField(decimal_places=2, max_digits=35),
),
migrations.AlterField(
model_name='product',
name='lot_area',
field=models.DecimalField(decimal_places=2, max_digits=35),
),
migrations.AlterField(
model_name='product',
name='origin_price',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='product',
name='price_excluding_vat',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='product',
name='total_built_area',
field=models.DecimalField(decimal_places=2, max_digits=35),
),
migrations.AlterField(
model_name='sale_policy',
name='deposit',
field=models.DecimalField(decimal_places=2, max_digits=35),
),
migrations.AlterField(
model_name='transaction',
name='amount_received',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction',
name='amount_remain',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction',
name='deposit_amount',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction',
name='deposit_received',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction',
name='deposit_remaining',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction',
name='discount_amount',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction',
name='early_discount_amount',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction',
name='origin_price',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction',
name='penalty_amount',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction',
name='sale_price',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction_detail',
name='amount',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction_detail',
name='amount_received',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction_detail',
name='amount_remaining',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
migrations.AlterField(
model_name='transaction_discount',
name='value',
field=models.DecimalField(decimal_places=2, max_digits=35, null=True),
),
]

View File

@@ -330,7 +330,7 @@ class Gift(models.Model):
class Sale_Policy(models.Model):
code = models.CharField(max_length=30, null=False, unique=True)
name = models.CharField(max_length=100, null=False)
deposit = models.DecimalField(max_digits=15, decimal_places=2)
deposit = models.DecimalField(max_digits=35, decimal_places=2)
method = models.ForeignKey(Payment_Method, null=False, related_name='+', on_delete=models.PROTECT)
enable = models.BooleanField(default=True)
contract_allocation_percentage = models.IntegerField(null=True,blank=True,default=100)
@@ -784,11 +784,11 @@ class Dealer(AutoCodeModel):
phone = models.CharField(max_length=20, null=True, db_index=True)
email = models.CharField(max_length=50, null=True)
address = models.CharField(max_length=255, null=True)
sale_amount = models.DecimalField(max_digits=15, decimal_places=2,null=True)
pay_sale = models.DecimalField(max_digits=15, decimal_places=2,null=True)
commission_amount = models.DecimalField(max_digits=15, decimal_places=2,null=True)
pay_commission = models.DecimalField(max_digits=15, decimal_places=2,null=True)
commission_remain = models.DecimalField(max_digits=15, decimal_places=2,null=True)
sale_amount = models.DecimalField(max_digits=35, decimal_places=2,null=True)
pay_sale = models.DecimalField(max_digits=35, decimal_places=2,null=True)
commission_amount = models.DecimalField(max_digits=35, decimal_places=2,null=True)
pay_commission = models.DecimalField(max_digits=35, decimal_places=2,null=True)
commission_remain = models.DecimalField(max_digits=35, decimal_places=2,null=True)
batch_date = models.DateTimeField(null=True)
count_sale = models.IntegerField(null=True)
create_time = models.DateTimeField(null=True, auto_now_add=True)
@@ -820,9 +820,9 @@ class Product(AutoCodeModel):
zone_code = models.CharField(max_length=255)
trade_code = models.CharField(max_length=20, null=True)
zone_type = models.ForeignKey(Zone_Type, null=False, related_name='+', on_delete=models.PROTECT)
lot_area = models.DecimalField(max_digits=15, decimal_places=2)
building_area = models.DecimalField(max_digits=15, decimal_places=2)
total_built_area = models.DecimalField(max_digits=15, decimal_places=2)
lot_area = models.DecimalField(max_digits=35, decimal_places=2)
building_area = models.DecimalField(max_digits=35, decimal_places=2)
total_built_area = models.DecimalField(max_digits=35, decimal_places=2)
number_of_floors = models.IntegerField()
land_lot_size = models.CharField(max_length=255)
direction = models.ForeignKey(Direction, null=False, related_name='+', on_delete=models.PROTECT)
@@ -834,8 +834,8 @@ class Product(AutoCodeModel):
dealer = models.ForeignKey(Dealer, null=True, related_name='+', on_delete=models.PROTECT)
policy = models.ForeignKey(Sale_Policy, null=True, related_name='+', on_delete=models.PROTECT)
note = models.TextField(null=True)
origin_price = models.DecimalField(max_digits=15, decimal_places=2, null=True)
price_excluding_vat = models.DecimalField(max_digits=15, decimal_places=2, null=True)
origin_price = models.DecimalField(max_digits=35, decimal_places=2, null=True)
price_excluding_vat = models.DecimalField(max_digits=35, decimal_places=2, null=True)
product_type = models.CharField(max_length=255, null=True)
template_name = models.CharField(max_length=255, null=True)
link = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, null=True)
@@ -1400,17 +1400,17 @@ class Transaction(AutoCodeModel):
policy = models.ForeignKey(Sale_Policy, null=False, related_name='txnplc', on_delete=models.PROTECT)
phase = models.ForeignKey(Transaction_Phase, null=False, related_name='+', on_delete=models.PROTECT)
date = models.DateField()
origin_price = models.DecimalField(max_digits=15, decimal_places=2, null=True)
discount_amount = models.DecimalField(max_digits=15, decimal_places=2, null=True)
sale_price = models.DecimalField(max_digits=15, decimal_places=2, null=True)
deposit_amount = models.DecimalField(max_digits=15, decimal_places=2, null=True)
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)
origin_price = models.DecimalField(max_digits=35, decimal_places=2, null=True)
discount_amount = models.DecimalField(max_digits=35, decimal_places=2, null=True)
sale_price = models.DecimalField(max_digits=35, decimal_places=2, null=True)
deposit_amount = models.DecimalField(max_digits=35, decimal_places=2, null=True)
deposit_received = models.DecimalField(max_digits=35, decimal_places=2, null=True)
deposit_remaining = models.DecimalField(max_digits=35, decimal_places=2, null=True)
amount_received = models.DecimalField(max_digits=35, decimal_places=2, null=True)
amount_remain = models.DecimalField(max_digits=35, decimal_places=2, null=True)
ovd_days = models.IntegerField(null=True)
penalty_amount = models.DecimalField(null=True, max_digits=15, decimal_places=2)
early_discount_amount = models.DecimalField(max_digits=15, decimal_places=2, null=True)
penalty_amount = models.DecimalField(null=True, max_digits=35, decimal_places=2)
early_discount_amount = models.DecimalField(max_digits=35, decimal_places=2, null=True)
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)
@@ -1424,9 +1424,9 @@ class Transaction_Detail(AutoCodeModel):
code_padding = 5
code = models.CharField(max_length=30, null=True, unique=True)
date = models.DateField()
amount = models.DecimalField(max_digits=15, decimal_places=2, null=True)
amount_remaining = models.DecimalField(max_digits=15, decimal_places=2, null=True)
amount_received = models.DecimalField(max_digits=15, decimal_places=2, null=True)
amount = models.DecimalField(max_digits=35, decimal_places=2, null=True)
amount_remaining = models.DecimalField(max_digits=35, decimal_places=2, null=True)
amount_received = models.DecimalField(max_digits=35, decimal_places=2, null=True)
due_date = models.DateField(null=True)
customer_old = models.ForeignKey(Customer, null=True, related_name='+', on_delete=models.PROTECT)
customer_new = models.ForeignKey(Customer, null=True, related_name='+', on_delete=models.PROTECT)
@@ -1669,9 +1669,9 @@ class Internal_Entry(AutoCodeModel):
account = models.ForeignKey(Internal_Account, null=False, related_name='+', on_delete=models.PROTECT)
date = models.DateField(null=False)
ref = models.CharField(max_length=30, null=True)
customer = models.ForeignKey(Customer, null=True, related_name='+', on_delete=models.PROTECT)
customer = models.ForeignKey(Customer, null=True, related_name='entrycus', on_delete=models.PROTECT)
product = models.ForeignKey(Product, null=True, related_name='+', on_delete=models.PROTECT)
allocation_amount = models.DecimalField(null=True, max_digits=15, decimal_places=2)
allocation_amount = models.DecimalField(null=True, max_digits=35, decimal_places=2)
allocation_detail = models.JSONField(null=True)
create_time = models.DateTimeField(null=True, auto_now_add=True)
update_time = models.DateTimeField(null=True, auto_now=True)
@@ -1696,9 +1696,9 @@ class Payment_Schedule(AutoCodeModel):
code = models.CharField(max_length=30, null=True, unique=True)
from_date = models.DateField(null=False)
to_date = models.DateField(null=False)
amount = models.DecimalField(max_digits=15, decimal_places=2)
paid_amount = models.DecimalField(null=True, max_digits=15, decimal_places=2)
remain_amount = models.DecimalField(null=True, max_digits=15, decimal_places=2)
amount = models.DecimalField(max_digits=35, decimal_places=2)
paid_amount = models.DecimalField(null=True, max_digits=35, decimal_places=2)
remain_amount = models.DecimalField(null=True, max_digits=35, decimal_places=2)
cycle = models.IntegerField(null=False)
cycle_days = models.IntegerField(null=False)
txn_detail = models.ForeignKey(Transaction_Detail, null=False, related_name='psh', on_delete=models.PROTECT)
@@ -1709,9 +1709,9 @@ class Payment_Schedule(AutoCodeModel):
detail = models.JSONField(null=True)
batch_date = models.DateField(null=True)
ovd_days = models.IntegerField(null=True)
penalty_amount = models.DecimalField(null=True, max_digits=15, decimal_places=2)
penalty_paid = models.DecimalField(null=True, max_digits=15, decimal_places=2)
penalty_reduce = models.DecimalField(null=True, max_digits=15, decimal_places=2)
penalty_amount = models.DecimalField(null=True, max_digits=35, decimal_places=2)
penalty_paid = models.DecimalField(null=True, max_digits=35, decimal_places=2)
penalty_reduce = models.DecimalField(null=True, max_digits=35, decimal_places=2)
create_time = models.DateTimeField(null=True, auto_now_add=True)
update_time = models.DateTimeField(null=True, auto_now=True)
@@ -2012,11 +2012,20 @@ class Email_Job(models.Model):
class Meta:
db_table = 'email_job'
class Transaction_Gift(models.Model):
transaction = models.ForeignKey(Transaction, null=False, related_name='txngift', on_delete=models.PROTECT)
gift = models.ForeignKey(Gift, null=False, related_name='+', on_delete=models.PROTECT)
create_time = models.DateTimeField(null=True, auto_now_add=True)
update_time = models.DateTimeField(null=True, auto_now=True)
class Meta:
db_table = 'transaction_gift'
class Transaction_Discount(models.Model):
transaction = models.ForeignKey(Transaction, null=False, related_name='txndiscount', on_delete=models.PROTECT)
discount = models.ForeignKey(Discount_Type, null=False, related_name='+', on_delete=models.PROTECT)
type = models.ForeignKey(Value_Type, null=False, related_name='+', on_delete=models.PROTECT)
value = models.DecimalField(max_digits=15, decimal_places=2, null=True)
value = models.DecimalField(max_digits=35, decimal_places=2, null=True)
create_time = models.DateTimeField(null=True, auto_now_add=True)
update_time = models.DateTimeField(null=True, auto_now=True)