fix Project model
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
from .cash_transaction import *
|
from .cash_transaction import *
|
||||||
|
from .payment_type import *
|
||||||
8
core/apps/finance/admin/payment_type.py
Normal file
8
core/apps/finance/admin/payment_type.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from core.apps.finance.models.payment_type import PaymentType
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(PaymentType)
|
||||||
|
class PaymentTypeAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ['id', 'name']
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Generated by Django 5.2.4 on 2025-08-04 14:54
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('finance', '0001_initial'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='PaymentType',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('name', models.CharField(max_length=200, unique=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': "To'lov turi",
|
||||||
|
'verbose_name_plural': "To'lov turlari",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='cashtransaction',
|
||||||
|
name='employees',
|
||||||
|
field=models.ManyToManyField(related_name='cash_transactions', to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='cashtransaction',
|
||||||
|
name='status',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='cashtransaction',
|
||||||
|
name='payment_type',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cash_transactions', to='finance.paymenttype'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1 +1,2 @@
|
|||||||
from .cash_transaction import *
|
from .cash_transaction import *
|
||||||
|
from .payment_type import *
|
||||||
@@ -2,15 +2,21 @@ from django.db import models
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from core.apps.shared.models import BaseModel
|
from core.apps.shared.models import BaseModel
|
||||||
|
from core.apps.finance.models.payment_type import PaymentType
|
||||||
|
from core.apps.accounts.models import User
|
||||||
|
|
||||||
|
|
||||||
class CashTransaction(BaseModel):
|
class CashTransaction(BaseModel):
|
||||||
name = models.CharField(max_length=200, unique=True)
|
name = models.CharField(max_length=200, unique=True)
|
||||||
|
payment_type = models.ForeignKey(
|
||||||
|
PaymentType, on_delete=models.CASCADE, related_name='cash_transactions', null=True
|
||||||
|
)
|
||||||
|
employees = models.ManyToManyField(User, related_name='cash_transactions')
|
||||||
|
status = models.BooleanField(default=False)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _('Kassa')
|
verbose_name = _('Kassa')
|
||||||
verbose_name_plural = _('Kassalar')
|
verbose_name_plural = _('Kassalar')
|
||||||
|
|
||||||
16
core/apps/finance/models/payment_type.py
Normal file
16
core/apps/finance/models/payment_type.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
from core.apps.shared.models import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class PaymentType(BaseModel):
|
||||||
|
name = models.CharField(max_length=200, unique=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = _("To'lov turi")
|
||||||
|
verbose_name_plural = _("To'lov turlari")
|
||||||
|
|
||||||
@@ -38,11 +38,11 @@ class Project(BaseModel):
|
|||||||
other_members = models.ManyToManyField(User, related_name='project_members')
|
other_members = models.ManyToManyField(User, related_name='project_members')
|
||||||
|
|
||||||
# project settings
|
# project settings
|
||||||
wherehouse = models.ForeignKey(
|
wherehouse = models.ManyToManyField(
|
||||||
WhereHouse, on_delete=models.CASCADE, related_name='projects', null=True
|
WhereHouse, related_name='projects'
|
||||||
)
|
)
|
||||||
cash_transaction = models.ForeignKey(
|
cash_transaction = models.ManyToManyField(
|
||||||
CashTransaction, on_delete=models.CASCADE, related_name='projects', null=True
|
CashTransaction, related_name='projects', null=True
|
||||||
)
|
)
|
||||||
currency = models.CharField(choices=[('usd', 'usd'),('uzs','uzs')], max_length=3, default='uzs')
|
currency = models.CharField(choices=[('usd', 'usd'),('uzs','uzs')], max_length=3, default='uzs')
|
||||||
benifit_plan = models.PositiveBigIntegerField(null=True)
|
benifit_plan = models.PositiveBigIntegerField(null=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user