def handle(self, *args, **kwargs):
     from invoicing.models import Currency
     try:
         Currency.refresh_currencies()
         print "Done."
     except Exception as e:
         raise CommandError(e)
Beispiel #2
0
 def handle(self, *args, **kwargs):
     from invoicing.models import Currency
     try:
         Currency.refresh_currencies()
         print "Done."
     except Exception as e:
         raise CommandError(e)
        def set_global_initial_data():
            from invoicing.models import Currency, ExchangeRate

            # Add Vosae supported currencies
            currencies_symbols = dict(settings.VOSAE_SUPPORTED_CURRENCIES).keys()
            exchange_rate_dt = datetime.datetime.now()
            for symbol in currencies_symbols:
                currency = Currency(symbol=symbol)
                for to_symbol in currencies_symbols:
                    if to_symbol == symbol:
                        continue
                    currency.rates.append(ExchangeRate(currency_to=to_symbol, datetime=exchange_rate_dt, rate=Decimal('1.00')))
                currency.save(upsert=True)
Beispiel #4
0
        def set_global_initial_data():
            from invoicing.models import Currency, ExchangeRate

            # Add Vosae supported currencies
            currencies_symbols = dict(
                settings.VOSAE_SUPPORTED_CURRENCIES).keys()
            exchange_rate_dt = datetime.datetime.now()
            for symbol in currencies_symbols:
                currency = Currency(symbol=symbol)
                for to_symbol in currencies_symbols:
                    if to_symbol == symbol:
                        continue
                    currency.rates.append(
                        ExchangeRate(currency_to=to_symbol,
                                     datetime=exchange_rate_dt,
                                     rate=Decimal('1.00')))
                currency.save(upsert=True)
Beispiel #5
0
def fetch_currencies():
    from invoicing.models import Currency
    Currency.refresh_currencies()