Add lot to stock model.

This commit is contained in:
Mario Hüttel 2021-12-30 23:33:43 +01:00
parent e6eb9346a8
commit e959f11051
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.5 on 2021-12-30 22:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('parts', '0006_auto_20211114_1524'),
]
operations = [
migrations.AddField(
model_name='stock',
name='lot',
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View File

@ -227,6 +227,7 @@ class Stock(models.Model):
storage = models.ForeignKey(Storage, on_delete=models.PROTECT, blank=True, null=True)
amount = models.PositiveIntegerField()
watermark = models.IntegerField() # negative is no watermark
lot = models.CharField(max_length=255, null=True, blank=True)
def atomic_increment(self, increment):
if self.amount + increment < 0: