Add lot number to add stock form
This commit is contained in:
@@ -79,6 +79,7 @@ class AddStockForm(forms.Form):
|
||||
watermark = forms.IntegerField(min_value=0, required=True, initial=0)
|
||||
amount = forms.IntegerField(min_value=0, required=True, initial=1)
|
||||
component_uuid = forms.UUIDField(required=True)
|
||||
lot = forms.CharField(max_length=255, required=False)
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super().clean()
|
||||
@@ -103,7 +104,7 @@ class AddStockForm(forms.Form):
|
||||
if self.cleaned_data.get('watermark_active'):
|
||||
watermark = self.cleaned_data.get('watermark')
|
||||
|
||||
new_stock = parts_models.Stock.objects.create(storage=storage, component=component, watermark=watermark, amount=amount)
|
||||
new_stock = parts_models.Stock.objects.create(storage=storage, component=component, watermark=watermark, amount=amount, lot=self.cleaned_data['lot'])
|
||||
new_stock.save()
|
||||
|
||||
class EditComponentForm(forms.Form):
|
||||
|
Reference in New Issue
Block a user