mirror of
https://github.com/Sosokker/Inventory-Management-System.git
synced 2025-12-19 15:34:04 +01:00
Add inventory models
This commit is contained in:
parent
d7506e45ff
commit
738a3a64e1
50
inventory/migrations/0001_initial.py
Normal file
50
inventory/migrations/0001_initial.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2023-11-18 09:51
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Inventory',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('max_stock', models.IntegerField()),
|
||||||
|
('min_stock', models.IntegerField()),
|
||||||
|
('current_stock', models.IntegerField()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Warehouse',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=255)),
|
||||||
|
('address', models.TextField()),
|
||||||
|
('have_freeze', models.BooleanField()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Item',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=255)),
|
||||||
|
('description', models.TextField()),
|
||||||
|
('category', models.CharField(max_length=255)),
|
||||||
|
('weight', models.DecimalField(decimal_places=3, max_digits=10)),
|
||||||
|
('quantity', models.IntegerField()),
|
||||||
|
('inventory', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.inventory')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='inventory',
|
||||||
|
name='warehouse',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.warehouse'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -1,3 +1,48 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
# Create your models here.
|
|
||||||
|
class Warehouse(models.Model):
|
||||||
|
"""
|
||||||
|
Warehouse is a place where items are stored.
|
||||||
|
|
||||||
|
:param name: Name of the warehouse
|
||||||
|
:param address: Address of the warehouse
|
||||||
|
:param have_freeze: Whether the warehouse have freezer or not
|
||||||
|
"""
|
||||||
|
name = models.CharField(max_length=255)
|
||||||
|
address = models.TextField()
|
||||||
|
have_freeze = models.BooleanField()
|
||||||
|
|
||||||
|
|
||||||
|
class Inventory(models.Model):
|
||||||
|
"""
|
||||||
|
Inventory is in warehouse, It can be a shelf, a room, a container etc.
|
||||||
|
|
||||||
|
:param warehouse: Warehouse that the inventory belongs to
|
||||||
|
:param max_stock: Maximum stock of the inventory
|
||||||
|
:param min_stock: Minimum stock of the inventory
|
||||||
|
:param current_stock: Current stock of the inventory
|
||||||
|
"""
|
||||||
|
warehouse = models.ForeignKey(Warehouse, on_delete=models.CASCADE)
|
||||||
|
max_stock = models.IntegerField()
|
||||||
|
min_stock = models.IntegerField()
|
||||||
|
current_stock = models.IntegerField()
|
||||||
|
|
||||||
|
|
||||||
|
class Item(models.Model):
|
||||||
|
"""
|
||||||
|
Item such as food, drink, furnoture etc.
|
||||||
|
|
||||||
|
:param inventory: Inventory that the item belongs to
|
||||||
|
:param name: Name of the item
|
||||||
|
:param description: Description of the item
|
||||||
|
:param category: Category of the item
|
||||||
|
:param weight: Weight of the item in kg
|
||||||
|
:param quantity: Quantity of the item
|
||||||
|
"""
|
||||||
|
inventory = models.ForeignKey(Inventory, on_delete=models.CASCADE)
|
||||||
|
name = models.CharField(max_length=255)
|
||||||
|
description = models.TextField()
|
||||||
|
category = models.CharField(max_length=255)
|
||||||
|
weight = models.DecimalField(max_digits=10, decimal_places=3)
|
||||||
|
quantity = models.IntegerField()
|
||||||
Loading…
Reference in New Issue
Block a user