23 lines
805 B
Python
23 lines
805 B
Python
from django.db import models
|
|
from .device import Device
|
|
from .warehouse import Warehouse
|
|
from ..choice import TOY_MOVEMENT_TYPE
|
|
|
|
class ToyMovement(models.Model):
|
|
movement_type = models.CharField(max_length=30, choices=TOY_MOVEMENT_TYPE)
|
|
from_warehouse = models.ForeignKey(
|
|
Warehouse, on_delete=models.PROTECT,
|
|
related_name="outgoing"
|
|
)
|
|
to_warehouse = models.ForeignKey(
|
|
Warehouse, on_delete=models.PROTECT,
|
|
related_name="incoming",
|
|
null=True, blank=True
|
|
)
|
|
device = models.ForeignKey(
|
|
Device, on_delete=models.PROTECT,
|
|
null=True, blank=True
|
|
)
|
|
quantity = models.PositiveIntegerField()
|
|
created_by = models.ForeignKey("accounts.User", on_delete=models.PROTECT)
|
|
created_at = models.DateTimeField(auto_now_add=True) |