add new features

This commit is contained in:
behruz-dev
2025-08-25 10:45:11 +05:00
parent a6d0266668
commit 74ecc581ae
9 changed files with 89 additions and 3 deletions

View File

@@ -1,15 +1,21 @@
from django.db import models
from django.utils.translation import gettext_lazy as _
# shared
from core.apps.shared.models import BaseModel
# warehouse
from core.apps.wherehouse.models.wherehouse import WhereHouse
# products
from core.apps.products.models.product import Product
from core.apps.products.models.unity import Unity
class Inventory(BaseModel):
wherehouse = models.ForeignKey(WhereHouse, on_delete=models.CASCADE, related_name='inventories')
quantity = models.PositiveIntegerField(default=0)
product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name='inventories')
unity = models.ForeignKey(Unity, on_delete=models.SET_NULL, related_name='inventories', null=True)
price = models.PositiveBigIntegerField(default=0)
def __str__(self):
return f'{self.product} in {self.wherehouse}'