fix(products): improve bulk category modal behavior and initialization
- Move default date initialization from form to view initial data - Add checks for DOM elements existence before event listener attachment - Handle 'clear' mode in bulk category modal with confirmation and API call - Improve CSRF token usage and error handling during bulk update requests - Remove deprecated handleClearAll function and integrate logic into handleApply - Reset modal state properly including input fields and radio button modes - Update modal JS file version reference in products list template
This commit is contained in:
@@ -35,6 +35,13 @@ class IncomingDocumentCreateView(LoginRequiredMixin, CreateView):
|
||||
form_class = IncomingDocumentForm
|
||||
template_name = 'inventory/incoming_document/incoming_document_form.html'
|
||||
|
||||
def get_initial(self):
|
||||
"""Устанавливаем начальные значения для формы"""
|
||||
initial = super().get_initial()
|
||||
from django.utils import timezone
|
||||
initial['date'] = timezone.now().date()
|
||||
return initial
|
||||
|
||||
def form_valid(self, form):
|
||||
document = IncomingDocumentService.create_document(
|
||||
warehouse=form.cleaned_data['warehouse'],
|
||||
|
||||
Reference in New Issue
Block a user