From fdfd7e7388a7a05ec46f626ba251e370c269d94d Mon Sep 17 00:00:00 2001 From: guillaume-renaud Date: Wed, 26 Oct 2016 22:12:56 +0200 Subject: [PATCH] Addition of the StockItem class --- stock/models.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/stock/models.py b/stock/models.py index 1fdbf62a..1749ccc0 100644 --- a/stock/models.py +++ b/stock/models.py @@ -7,4 +7,15 @@ class Stock(models.Model): counter = models.OneToOneField(Counter, verbose_name=_('counter'), related_name='stock') def __str__(self): - return self.name \ No newline at end of file + return self.name + +class StockItem(models.Model): + """ The StockItem class, element of the stock """ + name = models.CharField(_('name'), max_length=64) + unit_quantity = models.IntegerField(_('unit quantity'), default=0) + effective_quantity = models.IntegerField(_('effective quantity'), default=0) + stock_owner = models.ForeignKey(Stock, related_name="stock_owner") + + def __str__(self): + return self.name +