From 24da5d41b863259eb199fef3f1a42345e0956fa5 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 26 Apr 2022 20:21:15 +1000 Subject: [PATCH] Add migration file --- .../migrations/0074_alter_stockitem_batch.py | 19 +++++++++++++++++++ InvenTree/stock/models.py | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 InvenTree/stock/migrations/0074_alter_stockitem_batch.py diff --git a/InvenTree/stock/migrations/0074_alter_stockitem_batch.py b/InvenTree/stock/migrations/0074_alter_stockitem_batch.py new file mode 100644 index 0000000000..646e25199a --- /dev/null +++ b/InvenTree/stock/migrations/0074_alter_stockitem_batch.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.12 on 2022-04-26 10:19 + +from django.db import migrations, models +import stock.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0073_alter_stockitem_belongs_to'), + ] + + operations = [ + migrations.AlterField( + model_name='stockitem', + name='batch', + field=models.CharField(blank=True, default=stock.models.generate_batch_code, help_text='Batch code for this stock item', max_length=100, null=True, verbose_name='Batch Code'), + ), + ] diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 750b4df217..39697c1bca 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -227,6 +227,8 @@ def generate_batch_code(): now = datetime.now() + # Pass context data through to the template randering. + # The folowing context variables are availble for custom batch code generation context = { 'date': now, 'year': now.year,