diff --git a/InvenTree/company/forms.py b/InvenTree/company/forms.py index da90286b35..8ee434050f 100644 --- a/InvenTree/company/forms.py +++ b/InvenTree/company/forms.py @@ -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, diff --git a/InvenTree/company/views.py b/InvenTree/company/views.py index 758e8a2990..e82107ec14 100644 --- a/InvenTree/company/views.py +++ b/InvenTree/company/views.py @@ -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 diff --git a/InvenTree/order/models.py b/InvenTree/order/models.py index e888ae11c7..b2eb59c52e 100644 --- a/InvenTree/order/models.py +++ b/InvenTree/order/models.py @@ -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'), )