forked from inventree/InvenTree
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/inventree/InvenTree
- Loading branch information
Showing
118 changed files
with
2,845 additions
and
1,292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: Currency Exchange Mixin | ||
--- | ||
|
||
## CurrencyExchangeMixin | ||
|
||
The `CurrencyExchangeMixin` class enabled plugins to provide custom backends for updating currency exchange rate information. | ||
|
||
Any implementing classes must provide the `update_exchange_rates` method. A simple example is shown below (with fake data). | ||
|
||
```python | ||
|
||
from plugin import InvenTreePlugin | ||
from plugin.mixins import CurrencyExchangeMixin | ||
|
||
class MyFirstCurrencyExchangePlugin(CurrencyExchangeMixin, InvenTreePlugin): | ||
"""Sample currency exchange plugin""" | ||
|
||
... | ||
|
||
def update_exchange_rates(self, base_currency: str, symbols: list[str]) -> dict: | ||
"""Update currency exchange rates. | ||
This method *must* be implemented by the plugin class. | ||
Arguments: | ||
base_currency: The base currency to use for exchange rates | ||
symbols: A list of currency symbols to retrieve exchange rates for | ||
Returns: | ||
A dictionary of exchange rates, or None if the update failed | ||
Raises: | ||
Can raise any exception if the update fails | ||
""" | ||
|
||
rates = { | ||
'base_currency': 1.00 | ||
} | ||
|
||
for sym in symbols: | ||
rates[sym] = random.randrange(5, 15) * 0.1 | ||
|
||
return rates | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: Currency Support | ||
--- | ||
|
||
## Currency Support | ||
|
||
InvenTree provides support for multiple currencies, allowing pricing information to be stored with base currency rates. | ||
|
||
### Configuration | ||
|
||
To specify which currencies are supported, refer to the [currency configuration](../start/config.md#supported-currencies) section | ||
|
||
### Currency Conversion | ||
|
||
Currency conversion is provided via the [django-money](https://github.com/django-money/django-money) library. Pricing data can be converted seamlessly between the available currencies. | ||
|
||
### Currency Rate Updates | ||
|
||
Currency conversion rates are periodically updated, via an external currency exchange server. Out of the box, InvenTree uses the [frankfurter.app](https://www.frankfurter.app/) service, which is an open source currency API made freely available. | ||
|
||
#### Custom Rate Updates | ||
|
||
If a different currency exchange backend is needed, or a custom implementation is desired, the currency exchange framework can be extended [via plugins](../extend/plugins/currency.md). Plugins which implement custom currency exchange frameworks can be easily integrated into the InvenTree framework. | ||
|
||
### Currency Settings | ||
|
||
In the [settings screen](./global.md), under the *Pricing* section, the following currency settings are available: | ||
|
||
{% with id="currency-settings", url="settings/currency.png", description="Currency Exchange Settings" %} | ||
{% include 'img.html' %} | ||
{% endwith %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.