From c19241dc3812c92b150376c3c8108c3359aaf488 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Fri, 11 Dec 2015 11:42:51 +0200 Subject: Added upload prices function --- servo/forms/product.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'servo/forms/product.py') diff --git a/servo/forms/product.py b/servo/forms/product.py index 61969f1..7e0f52e 100644 --- a/servo/forms/product.py +++ b/servo/forms/product.py @@ -12,14 +12,8 @@ from servo.forms.base import BaseModelForm, DatepickerInput, TextInput class ProductSearchForm(forms.Form): - title = forms.CharField( - required=False, - label=_('Name contains') - ) - code = forms.CharField( - required=False, - label=_('Code contains') - ) + title = forms.CharField(required=False, label=_('Name contains')) + code = forms.CharField(required=False, label=_('Code contains')) description = forms.CharField( required=False, label=_('Description contains') @@ -213,13 +207,23 @@ class ReserveProductForm(forms.Form): """ Form for reserving products for a given SO """ - inventory = forms.ModelChoiceField( - queryset=Inventory.objects.none(), - label=_('Inventory') - ) + inventory = forms.ModelChoiceField(queryset=Inventory.objects.none(), + label=_('Inventory')) def __init__(self, order, *args, **kwargs): super(ReserveProductForm, self).__init__(*args, **kwargs) inventory = Inventory.objects.filter(location=order.location, product__in=order.products.all()) self.fields['inventory'].queryset = inventory + + +class UploadPricesForm(forms.Form): + datafile = forms.FileField(label=_('Price data in Excel format (.xlsx)'), + help_text=_('This will also update products with fixed prices')) + create_new = forms.BooleanField(label=_('Create new products'), + required=False, + initial=True, + help_text=_('Create products if not found')) + set_fixed = forms.BooleanField(label=_('Set fixed price'), + required=False, + help_text=_('Mark all uploaded products as having a fixed price')) -- cgit v1.2.3