mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Simplifty PartPriceInfo field
This commit is contained in:
parent
4a0be0dfb8
commit
c5a82f4b6e
@ -173,23 +173,7 @@ class PartPriceForm(forms.Form):
|
|||||||
help_text=_('Input quantity for price calculation')
|
help_text=_('Input quantity for price calculation')
|
||||||
)
|
)
|
||||||
|
|
||||||
currency = forms.ChoiceField(label='Currency', help_text=_('Select currency for price calculation'))
|
currency = forms.ModelChoiceField(queryset=Currency.objects.all(), label='Currency', help_text=_('Select currency for price calculation'))
|
||||||
|
|
||||||
def get_currency_choices(self):
|
|
||||||
""" Create options for Currency """
|
|
||||||
|
|
||||||
currencies = Currency.objects.all()
|
|
||||||
choices = [(None, '---------')]
|
|
||||||
|
|
||||||
for c in currencies:
|
|
||||||
choices.append((c.pk, str(c)))
|
|
||||||
|
|
||||||
return choices
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super().__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
self.fields['currency'].choices = self.get_currency_choices()
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Part
|
model = Part
|
||||||
|
Loading…
Reference in New Issue
Block a user