add: add new field to InvalidProduct model

This commit is contained in:
behruz-dev
2025-08-27 16:12:01 +05:00
parent dad1d5ede8
commit 992fdf8390
3 changed files with 51 additions and 6 deletions

View File

@@ -11,11 +11,17 @@ from core.apps.accounts.models import User
class InvalidProduct(BaseModel):
STATUS = (
INVALID_STATUS = (
('BROKEN', 'singan'),
('LOST', 'yoqolgan'),
('OTHER', 'boshqa'),
)
STATUS = (
('OPEN', 'ochiq'),
('EXPECTED', 'kutilmoqda'),
('ACCEPTED', 'qabul qilingan'),
('CANCELLED', 'bekor qilingan')
)
# relationship
inventory = models.ForeignKey(Inventory, on_delete=models.CASCADE, related_name='invalid_products')
@@ -26,9 +32,11 @@ class InvalidProduct(BaseModel):
work = models.ForeignKey(
EstimateWork, on_delete=models.SET_NULL, null=True, blank=True, related_name='invalid_products'
)
wherehouse = models.ForeignKey(WhereHouse, on_delete=models.CASCADE, related_name='invalid_products', null=True)
# required
amount = models.PositiveIntegerField()
status = models.CharField(max_length=20, choices=STATUS, default='other')
invalid_status = models.CharField(max_length=20, choices=INVALID_STATUS, default='other')
status = models.CharField(max_length=20, choices=STATUS, default='OPEN')
# optional
created_date = models.DateField(null=True, blank=True)
expiry_date = models.DateField(null=True, blank=True)