tarqatilgan mahsulotlar uchun api chiqarildi

This commit is contained in:
behruz-dev
2025-12-03 16:05:08 +05:00
parent 731abb6936
commit eaca6043a9
8 changed files with 142 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
from .product import *
from .order_item import *
from .order import *
from .payment import *
from .payment import *
from .distributed_product import *

View File

@@ -0,0 +1,21 @@
# django
from django.db import models
# shared
from core.apps.shared.models import BaseModel
# orders
from core.apps.orders.models import Product
# accounts
from core.apps.accounts.models import User
class DistributedProduct(BaseModel):
product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name='distributed_products')
date = models.DateField()
employee_name = models.CharField(max_length=200)
quantity = models.PositiveIntegerField()
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='distributed_products')
def __str__(self):
return f'{self.product} recieved for {self.employee_name}, quantity -> {self.quantity}x'