2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 03:25:42 +00:00

Add 'currency' option for company

- e.g. an external supplier might have a default currency
- Adds a form input which only allows selection of allowed currency codes
- Add unit testing for currency validation
This commit is contained in:
Oliver Walters
2020-11-12 11:02:10 +11:00
parent ebac06ebee
commit 1532be9c1e
7 changed files with 158 additions and 19 deletions

View File

@ -0,0 +1,23 @@
"""
User-configurable settings for the common app
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from moneyed import CURRENCIES
from common.models import InvenTreeSetting
def currency_code_default():
"""
Returns the default currency code (or USD if not specified)
"""
code = InvenTreeSetting.get_setting('INVENTREE_DEFAULT_CURRENCY')
if code not in CURRENCIES:
code = 'USD'
return code