Repository: akvo/akvo-rsr

Issue:
Move to IATI currencies
Currently, there's only 2 options for a currency in RSR: Euros and US Dollars. However, with the introduction of IATI fields we have also incorporated the IATI codelists for some fields that allow the list of IATI currencies including all possible currencies. We should extend the currencies of RSR, keeping in mind:
- [x] Project editor should allow to select all possible currencies and display it for any 'currency' field.
- [x] Show the currency code (e.g. EUR, USD, YEN) everywhere:
  - [x] Projects list
  - [x] Project page (summary, full report and finance tabs)
  - [x] Organisation page
- [x] All fields in the project editor should respond to the currency selection. When you switch to a different currency, this should happen for all fields that use a currency in the editor.



Discussion:
This is becoming more important with IATI. E.g. SNV receives funding from DFID and thus will have to report this project information in pounds. 
See here the codelist of currencies used in IATI: http://iatistandard.org/201/codelists/Currency/

Not really sure how individual currencies for budget items will work out considering they are summed on both the project page (finances tab) and project editor. Performing currency conversions seem like a bad idea as does removing the totals from the project page.

Thoughts?

### Test plan

**Selection:** ensure all IATI currencies are selectable in project editor
- [x] At project level
- [x] For budget items
- [x] For transactions
- [x] For disbursements
- [ ] Currency label for amounts fields in partials should update

**Display:** ensure 3-letter currency codes are displayed correctly

_Project page_
- [x] Summary tab
  - [x] Total budgets should be listed for each currency if project has budget items in multiple currencies
  - [x] Funds needed should show a tooltip in this case, and only show funds in project currency
- [x] Full report tab
  - [x] Ensure currency labeling is correct (especially for items in project currency, since it is blank in budget/transaction/disbursement models)
- [x] Finances tab
  - [x] Budget items should be listed with assigned currency
  - [x] Total budgets should be listed for each currency if project has budget items in multiple currencies
  - [x] Funds needed should show a tooltip in this case, and only show funds in project currency
  - [x] Project transactions should be listed with assigned currency

_Projects list_
- [x] Total budgets should be listed for each currency if project has budget items in multiple currencies
- [x] Funds needed should show a tooltip in this case, and only show funds in project currency

_Organisation page_
- [x] Tooltip should be visible for organisations with project currencies differing from organisation currency
- [x] Funding amounts should only include items in organisation's currency


Resolving patch:
diff --git a/akvo/rest/serializers/partnership.py b/akvo/rest/serializers/partnership.py
--- a/akvo/rest/serializers/partnership.py
+++ b/akvo/rest/serializers/partnership.py
@@ -23,6 +23,7 @@ class PartnershipSerializer(PartnershipRawSerializer):
     organisation_show_link = serializers.Field(source='organisation_show_link')
     partner_type = serializers.Field(source='iati_role_to_partner_type')
     organisation_role_label = serializers.Field(source='iati_organisation_role_label')
+    funding_amount_label = serializers.Field(source='funding_amount_with_currency')
 
 
 class PartnershipBasicSerializer(BaseRSRSerializer):
diff --git a/akvo/rsr/models/partnership.py b/akvo/rsr/models/partnership.py
--- a/akvo/rsr/models/partnership.py
+++ b/akvo/rsr/models/partnership.py
@@ -167,6 +167,12 @@ def organisation_show_link(self):
                                                    self.organisation.name)
         return ''
 
+    def funding_amount_with_currency(self):
+        """Returns the funding amount, prepended by the project's currency."""
+        if self.funding_amount and self.project and self.project.currency:
+            return u'{0} {1}'.format(self.project.currency, self.funding_amount)
+        return self.funding_amount
+
     class Meta:
         app_label = 'rsr'
         verbose_name = _(u'project partner')


Test patch: