Fix target date form field for SalesOrder

This commit is contained in:
Oliver Walters 2021-01-02 21:54:07 +11:00
parent 2b57ffeb08
commit b2a732197b
3 changed files with 7 additions and 8 deletions

View File

@ -34,7 +34,7 @@ class InvenTreeURLField(models.URLField):
})
class InvenTreeDatePickerFormField(forms.DateField):
class DatePickerFormField(forms.DateField):
"""
Custom date-picker field
"""

View File

@ -10,7 +10,7 @@ from django import forms
from InvenTree.forms import HelperForm
from InvenTree.fields import RoundingDecimalFormField
from InvenTree.fields import InvenTreeDatePickerFormField
from InvenTree.fields import DatePickerFormField
from .models import Build, BuildItem, BuildOrderAttachment
@ -35,7 +35,7 @@ class EditBuildForm(HelperForm):
'target_date': _('Order target date'),
}
target_date = InvenTreeDatePickerFormField(
target_date = DatePickerFormField(
help_text=_('Target date for build completion. Build will be overdue after this date.')
)

View File

@ -12,6 +12,7 @@ from mptt.fields import TreeNodeChoiceField
from InvenTree.forms import HelperForm
from InvenTree.fields import RoundingDecimalFormField
from InvenTree.fields import DatePickerFormField
from stock.models import StockLocation
from .models import PurchaseOrder, PurchaseOrderLineItem, PurchaseOrderAttachment
@ -120,6 +121,7 @@ class EditSalesOrderForm(HelperForm):
self.field_prefix = {
'reference': 'SO',
'link': 'fa-link',
'target_date': 'fa-calendar-alt',
}
self.field_placeholder = {
@ -128,11 +130,8 @@ class EditSalesOrderForm(HelperForm):
super().__init__(*args, **kwargs)
# TODO: Improve this using a better date picker
target_date = forms.DateField(
widget=forms.DateInput(
attrs={'type': 'date'},
)
target_date = DatePickerFormField(
help_text=_('Target date for order completion. Order will be overdue after this date.'),
)
class Meta: