diff --git a/currency_rate_update/README.md b/currency_rate_update/README.md index 0544b0b92..6420cec58 100644 --- a/currency_rate_update/README.md +++ b/currency_rate_update/README.md @@ -28,7 +28,8 @@ The module is able to use 4 different sources: 7. National Bank of Romania (Banca Nationala a Romaniei) -In the roadmap : Google Finance. +In the roadmap : + Google Finance. Updated daily from Citibank N.A., source in EUR. Information may be delayed. This is parsed from an HTML page, so it may be broken at anytime. @@ -42,9 +43,9 @@ the current day. The module supports multi-company currency in two ways: * the currencies are shared, you can set currency update only on one - company + company * the currency are separated, you can set currency on every company - separately + separately A function field lets you know your currency configuration. diff --git a/currency_rate_update/model/company.py b/currency_rate_update/model/company.py index dd413bc76..23ee79467 100644 --- a/currency_rate_update/model/company.py +++ b/currency_rate_update/model/company.py @@ -40,7 +40,6 @@ class res_company(models.Model): self.services_to_use.refresh_currency() _inherit = "res.company" - _name = "res.company" # Activate the currency update auto_currency_up = fields.Boolean( diff --git a/currency_rate_update/model/currency_rate_update.py b/currency_rate_update/model/currency_rate_update.py index d22033e5d..02095201d 100644 --- a/currency_rate_update/model/currency_rate_update.py +++ b/currency_rate_update/model/currency_rate_update.py @@ -58,6 +58,25 @@ supported_currency_array = [ "ZWD" ] +YAHOO_supported_currency_array = [ + "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", + "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", + "BSD", "BTN", "BWP", "BYR", "BZD", "CAD", "CDF", "CHF", "CLF", "CLP", + "CNH", "CNY", "COP", "CRC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", + "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", + "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", + "IDR", "IEP", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", + "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", + "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", + "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", + "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", + "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", + "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", + "SRD", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", + "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VEF", + "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XCD", "XCP", "XDR", "XOF", + "XPD", "XPF", "XPT", "YER", "ZAR", "ZMW", "ZWL"] + RO_BNR_supported_currency_array = [ "AED", "AUD", "BGN", "BRL", "CAD", "CHF", "CNY", "CZK", "DKK", "EGP", "EUR", "GBP", "HUF", "INR", "JPY", "KRW", "MDL", "MXN", "NOK", "NZD", @@ -103,7 +122,16 @@ PL_NBP_supported_currency_array = [ "LTL", "MXN", "MYR", "NOK", "NZD", "PHP", "PLN", "RON", "RUB", "SEK", "SGD", "THB", "TRY", "UAH", "USD", "XDR", "ZAR"] - +supported_currecies = { + 'YAHOO_getter': YAHOO_supported_currency_array, + 'ECB_getter': ECB_supported_currency_array, + 'RO_BNR_getter': RO_BNR_supported_currency_array, + 'CA_BOC_getter': CA_BOC_supported_currency_array, + 'CH_ADMIN_getter': CH_ADMIN_supported_currency_array, + 'MX_BdM_getter': MX_BdM_supported_currency_array, + 'PL_NBP_getter': PL_NBP_supported_currency_array, + } + class Currency_rate_update_service(models.Model): """Class keep services and currencies that have to be updated""" @@ -138,18 +166,7 @@ class Currency_rate_update_service(models.Model): company_id = False if self.company_id.multi_company_currency_enable: company_id = self.company_id.id - if self.service == 'ECB_getter': - currency_list = ECB_supported_currency_array - if self.service == 'RO_BNR_getter': - currency_list = RO_BNR_supported_currency_array - if self.service == 'CA_BOC_getter': - currency_list = CA_BOC_supported_currency_array - if self.service == 'CH_ADMIN_getter': - currency_list = CH_ADMIN_supported_currency_array - if self.service == 'MX_BdM_getter': - currency_list = MX_BdM_supported_currency_array - if self.service == 'PL_NBP_getter': - currency_list = PL_NBP_supported_currency_array + currency_list = supported_currecies[self.service] if company_id: currencies = self.env['res.currency'].search( [('name', 'in', currency_list),