mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 15:15:42 +00:00 
			
		
		
		
	- 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
		
			
				
	
	
		
			24 lines
		
	
	
		
			451 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			451 B
		
	
	
	
		
			Python
		
	
	
	
	
	
"""
 | 
						|
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
 |