add: add type income crud and model
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
from .cash_transaction import *
|
||||
from .payment_type import *
|
||||
from .payment_type import *
|
||||
from .type_income import *
|
||||
from .income import *
|
||||
41
core/apps/finance/models/income.py
Normal file
41
core/apps/finance/models/income.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from django.db import models
|
||||
|
||||
from core.apps.shared.models import BaseModel
|
||||
from core.apps.finance.models import CashTransaction, PaymentType, TypeIncome
|
||||
from core.apps.counterparty.models import Counterparty
|
||||
|
||||
|
||||
class Income(BaseModel):
|
||||
cash_transaction = models.ForeignKey(
|
||||
CashTransaction, on_delete=models.CASCADE, related_name='incomes'
|
||||
)
|
||||
payment_type = models.ForeignKey(PaymentType, on_delete=models.CASCADE, related_name='incomes')
|
||||
project_folder = models.ForeignKey(
|
||||
'projects.ProjectFolder', on_delete=models.CASCADE, related_name='incomes'
|
||||
)
|
||||
project = models.ForeignKey(
|
||||
'projects.Project', on_delete=models.SET_NULL, related_name='incomes', null=True
|
||||
)
|
||||
counterparty = models.ForeignKey(
|
||||
Counterparty, on_delete=models.SET_NULL, related_name='incomes', null=True
|
||||
)
|
||||
type_income = models.ForeignKey(
|
||||
TypeIncome, on_delete=models.SET_NULL, related_name='incomes', null=True
|
||||
)
|
||||
|
||||
currency = models.CharField(choices=[('uzs', 'uzs'),('usd', 'usd')], max_length=3)
|
||||
price = models.PositiveBigIntegerField()
|
||||
exchange_rate = models.PositiveBigIntegerField(default=0)
|
||||
date = models.DateField()
|
||||
comment = models.TextField(null=True, blank=True)
|
||||
file = models.FileField(upload_to='finance/income/file/', null=True, blank=True)
|
||||
audit = models.CharField(max_length=200)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.cash_transaction} kassa uchun kirim {self.price}'
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'kirim'
|
||||
verbose_name_plural = 'kirimlar'
|
||||
|
||||
|
||||
23
core/apps/finance/models/type_income.py
Normal file
23
core/apps/finance/models/type_income.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from django.db import models
|
||||
|
||||
from core.apps.shared.models import BaseModel
|
||||
|
||||
|
||||
class TypeIncome(BaseModel):
|
||||
name = models.CharField(max_length=200)
|
||||
category = models.CharField(
|
||||
choices=[('OTHERS', 'boshqalar'), ('CONTANT_INCOME', 'doimiy daromad')], max_length=20
|
||||
)
|
||||
activity = models.CharField(
|
||||
max_length=20, choices=[('FINANCIAL', 'moliyaviy'), ('CAPITAL', 'sarmoya')]
|
||||
)
|
||||
comment = models.CharField(max_length=200)
|
||||
status = models.BooleanField(default=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'Daromad turi'
|
||||
verbose_name = 'Daromad turlari'
|
||||
|
||||
Reference in New Issue
Block a user