mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fixes for 'single pricing' for SupplierPart
This commit is contained in:
parent
7879c7565e
commit
fd79f1ea0e
@ -79,7 +79,7 @@ class EditSupplierPartForm(HelperForm):
|
||||
|
||||
single_pricing = MoneyField(
|
||||
label=_('Single Price'),
|
||||
default_currency=InvenTreeSetting.get_setting('INVENTREE_DEFAULT_CURRENCY'),
|
||||
default_currency='USD',
|
||||
help_text=_('Single quantity price'),
|
||||
decimal_places=4,
|
||||
max_digits=19,
|
||||
|
@ -306,11 +306,14 @@ class SupplierPartCreate(AjaxCreateView):
|
||||
supplier_id = self.get_param('supplier')
|
||||
part_id = self.get_param('part')
|
||||
|
||||
supplier = None
|
||||
|
||||
if supplier_id:
|
||||
try:
|
||||
initials['supplier'] = Company.objects.get(pk=supplier_id)
|
||||
supplier = Company.objects.get(pk=supplier_id)
|
||||
initials['supplier'] = supplier
|
||||
except (ValueError, Company.DoesNotExist):
|
||||
pass
|
||||
supplier = None
|
||||
|
||||
if manufacturer_id:
|
||||
try:
|
||||
@ -323,6 +326,17 @@ class SupplierPartCreate(AjaxCreateView):
|
||||
initials['part'] = Part.objects.get(pk=part_id)
|
||||
except (ValueError, Part.DoesNotExist):
|
||||
pass
|
||||
|
||||
# Initial value for single pricing
|
||||
if supplier:
|
||||
currency_code = supplier.currency_code
|
||||
else:
|
||||
currency_code = common.settings.currency_code_default()
|
||||
|
||||
currency = CURRENCIES.get(currency_code, None)
|
||||
|
||||
if currency_code:
|
||||
initials['single_pricing'] = ('', currency)
|
||||
|
||||
return initials
|
||||
|
||||
|
@ -505,7 +505,7 @@ class PurchaseOrderLineItem(OrderLineItem):
|
||||
max_digits=19,
|
||||
decimal_places=4,
|
||||
default_currency='USD',
|
||||
null=True,
|
||||
null=True, blank=True,
|
||||
verbose_name=_('Purchase Price'),
|
||||
help_text=_('Unit purchase price'),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user