mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 03:56:43 +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(
|
single_pricing = MoneyField(
|
||||||
label=_('Single Price'),
|
label=_('Single Price'),
|
||||||
default_currency=InvenTreeSetting.get_setting('INVENTREE_DEFAULT_CURRENCY'),
|
default_currency='USD',
|
||||||
help_text=_('Single quantity price'),
|
help_text=_('Single quantity price'),
|
||||||
decimal_places=4,
|
decimal_places=4,
|
||||||
max_digits=19,
|
max_digits=19,
|
||||||
|
@ -306,11 +306,14 @@ class SupplierPartCreate(AjaxCreateView):
|
|||||||
supplier_id = self.get_param('supplier')
|
supplier_id = self.get_param('supplier')
|
||||||
part_id = self.get_param('part')
|
part_id = self.get_param('part')
|
||||||
|
|
||||||
|
supplier = None
|
||||||
|
|
||||||
if supplier_id:
|
if supplier_id:
|
||||||
try:
|
try:
|
||||||
initials['supplier'] = Company.objects.get(pk=supplier_id)
|
supplier = Company.objects.get(pk=supplier_id)
|
||||||
|
initials['supplier'] = supplier
|
||||||
except (ValueError, Company.DoesNotExist):
|
except (ValueError, Company.DoesNotExist):
|
||||||
pass
|
supplier = None
|
||||||
|
|
||||||
if manufacturer_id:
|
if manufacturer_id:
|
||||||
try:
|
try:
|
||||||
@ -324,6 +327,17 @@ class SupplierPartCreate(AjaxCreateView):
|
|||||||
except (ValueError, Part.DoesNotExist):
|
except (ValueError, Part.DoesNotExist):
|
||||||
pass
|
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
|
return initials
|
||||||
|
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ class PurchaseOrderLineItem(OrderLineItem):
|
|||||||
max_digits=19,
|
max_digits=19,
|
||||||
decimal_places=4,
|
decimal_places=4,
|
||||||
default_currency='USD',
|
default_currency='USD',
|
||||||
null=True,
|
null=True, blank=True,
|
||||||
verbose_name=_('Purchase Price'),
|
verbose_name=_('Purchase Price'),
|
||||||
help_text=_('Unit purchase price'),
|
help_text=_('Unit purchase price'),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user