mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Improve the 'creation date' for order
- Automatically set on first save
This commit is contained in:
parent
477ac68aa0
commit
78bfc0b6a8
InvenTree/order
18
InvenTree/order/migrations/0012_auto_20190617_1943.py
Normal file
18
InvenTree/order/migrations/0012_auto_20190617_1943.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.2 on 2019-06-17 09:43
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('order', '0011_auto_20190615_1928'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='purchaseorder',
|
||||
name='creation_date',
|
||||
field=models.DateField(blank=True, null=True),
|
||||
),
|
||||
]
|
@ -50,6 +50,12 @@ class Order(models.Model):
|
||||
|
||||
return " ".join(el)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.creation_date:
|
||||
self.creation_date = dateimt.now().date()
|
||||
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
@ -59,7 +65,7 @@ class Order(models.Model):
|
||||
|
||||
URL = models.URLField(blank=True, help_text=_('Link to external page'))
|
||||
|
||||
creation_date = models.DateField(auto_now=True, editable=False)
|
||||
creation_date = models.DateField(blank=True, null=True)
|
||||
|
||||
status = models.PositiveIntegerField(default=OrderStatus.PENDING, choices=OrderStatus.items(),
|
||||
help_text='Order status')
|
||||
|
Loading…
Reference in New Issue
Block a user