change: add filters to inventory list api

This commit is contained in:
behruz-dev
2025-08-26 16:47:54 +05:00
parent 2ae04c76e9
commit 7a8efa74ff
5 changed files with 69 additions and 13 deletions

View File

@@ -8,6 +8,8 @@ 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
# projects
from core.apps.projects.models import Project, ProjectFolder
class Inventory(BaseModel):
@@ -16,6 +18,14 @@ class Inventory(BaseModel):
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)
project_folder = models.ForeignKey(
ProjectFolder, on_delete=models.SET_NULL, null=True, blank=True,
related_name='inventories'
)
project = models.ForeignKey(
Project, on_delete=models.SET_NULL, null=True, blank=True,
related_name='inventories'
)
def __str__(self):
return f'{self.product} in {self.wherehouse}'