mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Delete CompanyCreate AJAX view
This commit is contained in:
		| @@ -71,7 +71,7 @@ | ||||
|                         field: 'manufacturer', | ||||
|                         label: '{% trans "New Manufacturer" %}', | ||||
|                         title: '{% trans "Create new Manufacturer" %}', | ||||
|                         url: "{% url 'manufacturer-create' %}", | ||||
|                         //url: "{% url 'manufacturer-create' %}", | ||||
|                     }, | ||||
|                 ] | ||||
|             }); | ||||
|   | ||||
| @@ -71,7 +71,7 @@ | ||||
|                         field: 'supplier', | ||||
|                         label: "{% trans 'New Supplier' %}", | ||||
|                         title: "{% trans 'Create new Supplier' %}", | ||||
|                         url: "{% url 'supplier-create' %}", | ||||
|                         // url: "{% url 'supplier-create' %}", | ||||
|                     }, | ||||
|                 ] | ||||
|             }); | ||||
|   | ||||
| @@ -81,7 +81,7 @@ $('#supplier-create').click(function () { | ||||
|                     field: 'supplier', | ||||
|                     label: '{% trans "New Supplier" %}', | ||||
|                     title: '{% trans "Create new supplier" %}', | ||||
|                     url: "{% url 'supplier-create' %}" | ||||
|                     // url: "{% url 'supplier-create' %}" | ||||
|                 }, | ||||
|             ] | ||||
|         }); | ||||
|   | ||||
| @@ -8,7 +8,6 @@ from . import views | ||||
|  | ||||
|  | ||||
| company_detail_urls = [ | ||||
|     url(r'edit/?', views.CompanyEdit.as_view(), name='company-edit'), | ||||
|     url(r'delete/?', views.CompanyDelete.as_view(), name='company-delete'), | ||||
|  | ||||
|     # url(r'orders/?', views.CompanyDetail.as_view(template_name='company/orders.html'), name='company-detail-orders'), | ||||
| @@ -31,11 +30,6 @@ company_detail_urls = [ | ||||
|  | ||||
| company_urls = [ | ||||
|  | ||||
|     url(r'new/supplier/', views.CompanyCreate.as_view(), name='supplier-create'), | ||||
|     url(r'new/manufacturer/', views.CompanyCreate.as_view(), name='manufacturer-create'), | ||||
|     url(r'new/customer/', views.CompanyCreate.as_view(), name='customer-create'), | ||||
|     url(r'new/?', views.CompanyCreate.as_view(), name='company-create'), | ||||
|  | ||||
|     url(r'^(?P<pk>\d+)/', include(company_detail_urls)), | ||||
|  | ||||
|     url(r'suppliers/', views.CompanyIndex.as_view(), name='supplier-index'), | ||||
|   | ||||
| @@ -246,61 +246,6 @@ class CompanyImage(AjaxUpdateView): | ||||
|         } | ||||
|  | ||||
|  | ||||
| class CompanyCreate(AjaxCreateView): | ||||
|     """ | ||||
|     View for creating a new Company object | ||||
|     """ | ||||
|      | ||||
|     model = Company | ||||
|     context_object_name = 'company' | ||||
|     form_class = EditCompanyForm | ||||
|     ajax_template_name = 'modal_form.html' | ||||
|     permission_required = 'company.add_company' | ||||
|  | ||||
|     def get_form_title(self): | ||||
|  | ||||
|         url = self.request.path | ||||
|  | ||||
|         if url == reverse('supplier-create'): | ||||
|             return _("Create new Supplier") | ||||
|  | ||||
|         if url == reverse('manufacturer-create'): | ||||
|             return _('Create new Manufacturer') | ||||
|  | ||||
|         if url == reverse('customer-create'): | ||||
|             return _('Create new Customer') | ||||
|  | ||||
|         return _('Create new Company') | ||||
|  | ||||
|     def get_initial(self): | ||||
|         """ Initial values for the form data """ | ||||
|         initials = super().get_initial().copy() | ||||
|  | ||||
|         url = self.request.path | ||||
|  | ||||
|         if url == reverse('supplier-create'): | ||||
|             initials['is_supplier'] = True | ||||
|             initials['is_customer'] = False | ||||
|             initials['is_manufacturer'] = False | ||||
|  | ||||
|         elif url == reverse('manufacturer-create'): | ||||
|             initials['is_manufacturer'] = True | ||||
|             initials['is_supplier'] = True | ||||
|             initials['is_customer'] = False | ||||
|  | ||||
|         elif url == reverse('customer-create'): | ||||
|             initials['is_customer'] = True | ||||
|             initials['is_manufacturer'] = False | ||||
|             initials['is_supplier'] = False | ||||
|  | ||||
|         return initials | ||||
|  | ||||
|     def get_data(self): | ||||
|         return { | ||||
|             'success': _("Created new company"), | ||||
|         } | ||||
|  | ||||
|  | ||||
| class CompanyDelete(AjaxDeleteView): | ||||
|     """ View for deleting a Company object """ | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user