mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-02 13:28:49 +00:00
PEP style fixes
This commit is contained in:
parent
6085478672
commit
4520bb7447
@ -7,7 +7,7 @@ class InvenTreeExchange(SimpleExchangeBackend):
|
|||||||
"""
|
"""
|
||||||
Backend for automatically updating currency exchange rates.
|
Backend for automatically updating currency exchange rates.
|
||||||
|
|
||||||
Uses the exchangerate.host service API
|
Uses the exchangerate.host service API
|
||||||
"""
|
"""
|
||||||
|
|
||||||
name = "InvenTreeExchange"
|
name = "InvenTreeExchange"
|
||||||
|
@ -26,7 +26,6 @@ from part.models import Part, PartCategory
|
|||||||
from stock.models import StockLocation, StockItem
|
from stock.models import StockLocation, StockItem
|
||||||
from common.models import InvenTreeSetting, ColorTheme
|
from common.models import InvenTreeSetting, ColorTheme
|
||||||
from users.models import check_user_role, RuleSet
|
from users.models import check_user_role, RuleSet
|
||||||
from InvenTree.helpers import clean_decimal
|
|
||||||
|
|
||||||
import InvenTree.tasks
|
import InvenTree.tasks
|
||||||
|
|
||||||
@ -775,7 +774,6 @@ class SettingsView(TemplateView):
|
|||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CurrencyRefreshView(RedirectView):
|
class CurrencyRefreshView(RedirectView):
|
||||||
|
|
||||||
url = reverse_lazy("settings-currencies")
|
url = reverse_lazy("settings-currencies")
|
||||||
@ -819,6 +817,7 @@ class CurrencySettingsView(TemplateView):
|
|||||||
|
|
||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
|
|
||||||
class AppearanceSelectView(FormView):
|
class AppearanceSelectView(FormView):
|
||||||
""" View for selecting a color theme """
|
""" View for selecting a color theme """
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ from django.db import models, transaction
|
|||||||
from django.db.utils import IntegrityError, OperationalError
|
from django.db.utils import IntegrityError, OperationalError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
import djmoney.settings
|
|
||||||
from djmoney.models.fields import MoneyField
|
from djmoney.models.fields import MoneyField
|
||||||
from djmoney.contrib.exchange.models import convert_money
|
from djmoney.contrib.exchange.models import convert_money
|
||||||
from djmoney.contrib.exchange.exceptions import MissingRate
|
from djmoney.contrib.exchange.exceptions import MissingRate
|
||||||
|
@ -98,20 +98,15 @@ class SettingsViewTest(TestCase):
|
|||||||
Tests for a setting which has choices
|
Tests for a setting which has choices
|
||||||
"""
|
"""
|
||||||
|
|
||||||
setting = InvenTreeSetting.get_setting_object('INVENTREE_DEFAULT_CURRENCY')
|
setting = InvenTreeSetting.get_setting_object('PURCHASEORDER_REFERENCE_PREFIX')
|
||||||
|
|
||||||
# Default value!
|
# Default value!
|
||||||
self.assertEqual(setting.value, 'USD')
|
self.assertEqual(setting.value, 'PO')
|
||||||
|
|
||||||
url = self.get_url(setting.pk)
|
url = self.get_url(setting.pk)
|
||||||
|
|
||||||
# Try posting an invalid currency option
|
# Try posting an invalid currency option
|
||||||
data, errors = self.post(url, {'value': 'XPQaaa'}, valid=False)
|
data, errors = self.post(url, {'value': 'Purchase Order'}, valid=True)
|
||||||
|
|
||||||
self.assertIsNotNone(errors.get('value'), None)
|
|
||||||
|
|
||||||
# Try posting a valid currency option
|
|
||||||
data, errors = self.post(url, {'value': 'AUD'}, valid=True)
|
|
||||||
|
|
||||||
def test_binary_values(self):
|
def test_binary_values(self):
|
||||||
"""
|
"""
|
||||||
|
@ -11,9 +11,6 @@ from .models import Company, Contact, ManufacturerPart, SupplierPart
|
|||||||
from .models import rename_company_image
|
from .models import rename_company_image
|
||||||
from part.models import Part
|
from part.models import Part
|
||||||
|
|
||||||
from InvenTree.exchange import InvenTreeManualExchangeBackend
|
|
||||||
from djmoney.contrib.exchange.models import Rate
|
|
||||||
|
|
||||||
|
|
||||||
class CompanySimpleTest(TestCase):
|
class CompanySimpleTest(TestCase):
|
||||||
|
|
||||||
@ -40,16 +37,6 @@ class CompanySimpleTest(TestCase):
|
|||||||
self.acme0002 = SupplierPart.objects.get(SKU='ACME0002')
|
self.acme0002 = SupplierPart.objects.get(SKU='ACME0002')
|
||||||
self.zerglphs = SupplierPart.objects.get(SKU='ZERGLPHS')
|
self.zerglphs = SupplierPart.objects.get(SKU='ZERGLPHS')
|
||||||
self.zergm312 = SupplierPart.objects.get(SKU='ZERGM312')
|
self.zergm312 = SupplierPart.objects.get(SKU='ZERGM312')
|
||||||
|
|
||||||
# Exchange rate backend
|
|
||||||
backend = InvenTreeManualExchangeBackend()
|
|
||||||
backend.update_rates(base_currency=backend.base_currency)
|
|
||||||
|
|
||||||
Rate.objects.create(
|
|
||||||
currency='AUD',
|
|
||||||
value='1.35',
|
|
||||||
backend_id=backend.name,
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_company_model(self):
|
def test_company_model(self):
|
||||||
c = Company.objects.get(name='ABC Co.')
|
c = Company.objects.get(name='ABC Co.')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user