Skip to content

Commit

Permalink
Merge pull request #541 from ZvonokComGroup/opt-money-operations
Browse files Browse the repository at this point in the history
Optimize money operations on moneys with the same currencies
  • Loading branch information
benjaoming committed Feb 14, 2020
2 parents e46109f + afba18e commit eaa8df7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion djmoney/money.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def maybe_convert(value, currency):
"""
Converts other Money instances to the local currency if `AUTO_CONVERT_MONEY` is set to True.
"""
if getattr(settings, "AUTO_CONVERT_MONEY", False):
if getattr(settings, "AUTO_CONVERT_MONEY", False) and value.currency != currency:
from .contrib.exchange.models import convert_money

return convert_money(value, currency)
Expand Down
5 changes: 5 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ Changelog

`1.1`_ - TBA

Fixed
~~~~~

- Optimize money operations on monies with the same currencies. (`horpto`)

Added
~~~~~

Expand Down

0 comments on commit eaa8df7

Please sign in to comment.