add - whole system of inventory entry in organization quotas stat
This commit is contained in:
@@ -19,6 +19,12 @@ class InventoryEntry(BaseModel):
|
||||
related_name='inventory_entry',
|
||||
null=True
|
||||
)
|
||||
quota = models.ForeignKey(
|
||||
product_models.Quota,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='inventory_entry',
|
||||
null=True
|
||||
)
|
||||
organization = models.ForeignKey(
|
||||
product_models.Organization,
|
||||
on_delete=models.CASCADE,
|
||||
@@ -38,7 +44,7 @@ class InventoryEntry(BaseModel):
|
||||
# prefix = "POS"
|
||||
while True:
|
||||
number_part = ''.join(random.choices(string.digits, k=6))
|
||||
code = f"{self.distribution.quota.quota_id}{number_part}"
|
||||
code = f"{self.quota.quota_id}{number_part}"
|
||||
if not InventoryEntry.objects.filter(entry_identity=code).exists():
|
||||
return code
|
||||
|
||||
|
||||
Reference in New Issue
Block a user