Fix some flake8, imports not used.

This commit is contained in:
Fekete Mihai
2014-11-10 14:36:02 +02:00
parent 0962a71240
commit 2901bfb0a5
4 changed files with 58 additions and 59 deletions

View File

@@ -19,7 +19,7 @@
#
##############################################################################
from openerp import models, fields, api, _
from openerp import models, fields, api
class res_company(models.Model):
@@ -52,7 +52,7 @@ class res_company(models.Model):
string="Multi company currency",
compute="_compute_multi_curr_enable",
help="When this option is unchecked it will allow users "
"to set a distinct currency updates on each company."
"to set a distinct currency updates on each company."
)
# List of services to fetch rates
services_to_use = fields.One2many(

View File

@@ -25,7 +25,7 @@ from datetime import datetime
from dateutil.relativedelta import relativedelta
from openerp import models, fields, api, _
from openerp.exceptions import except_orm, Warning
from openerp.exceptions import Warning
from ..services.currency_getter import Currency_getter_factory
@@ -58,47 +58,50 @@ supported_currency_array = [
"ZWD"
]
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", "PLN", "RON", "RSD", "RUB", "SEK", "TRY",
"UAH", "USD", "XAU", "XDR", "ZAR"]
CA_BOC_supported_currency_array = ["AED", "ANG", "ARS", "AUD", "BOC", "BRL",
"BSD", "CHF", "CLP", "CNY", "COP", "CZK", "DKK", "EUR", "FJD", "GBP",
"GHS", "GTQ", "HKD", "HNL", "HRK", "HUF", "IDR", "ILS", "INR", "ISK",
"JMD", "JPY", "KRW", "LKR", "MAD", "MMK", "MXN", "MYR", "NOK", "NZD",
"PAB", "PEN", "PHP", "PKR", "PLN", "RON", "RSD", "RUB", "SEK", "SGD",
"THB", "TND", "TRY", "TTD", "TWD", "USD", "VEF", "VND", "XAF", "XCD",
"XPF", "ZAR"]
CH_ADMIN_supported_currency_array = ['AED', 'ALL', 'ARS', 'AUD', 'AZN', 'BAM',
'BDT', 'BGN', 'BHD', 'BRL', 'CAD', 'CHF', 'CLP', 'CNY', 'COP', 'CRC',
'CZK', 'DKK', 'DOP', 'EGP', 'ETB', 'EUR', 'GBP', 'GTQ', 'HKD', 'HNL',
'HRK', 'HUF', 'IDR', 'ILS', 'INR', 'ISK', 'JPY', 'KES', 'KHR', 'KRW',
'KWD', 'KYD', 'KZT', 'LBP', 'LKR', 'LTL', 'LVL', 'LYD', 'MAD', 'MUR',
'MXN', 'MYR', 'NGN', 'NOK', 'NZD', 'OMR', 'PAB', 'PEN', 'PHP', 'PKR',
'PLN', 'QAR', 'RON', 'RSD', 'RUB', 'SAR', 'SEK', 'SGD', 'THB', 'TND',
'TRY', 'TWD', 'TZS', 'UAH', 'USD', 'UYU', 'VEF', 'VND', 'ZAR']
ECB_supported_currency_array = ['AUD', 'BGN', 'BRL', 'CAD', 'CHF', 'CNY',
'CZK', 'DKK', 'GBP', 'HKD', 'HRK', 'HUF', 'IDR', 'ILS', 'INR', 'JPY',
'KRW', 'LTL', 'MXN', 'MYR', 'NOK', 'NZD', 'PHP', 'PLN', 'RON', 'RUB',
'SEK', 'SGD', 'THB', 'TRY', 'USD', 'ZAR']
MX_BdM_supported_currency_array = ["ARS", "AUD", "BBD", "BMD", "BOB", "BRL",
"BSD", "BZD", "CAD", "CHF", "CLP", "CNH", "CNY", "COP", "CRC", "CUP",
"CZK", "DKK", "DOP", "DZD", "EGP", "ESD", "EUR", "FJD", "GBP", "GTQ",
"GYD", "HKD", "HNL", "HUF", "IDR", "ILS", "INR", "IQD", "JMD", "JPY",
"KES", "KRW", "KWD", "MAD", "MYR", "NGN", "NIC", "NOK", "NZD", "PAB",
"PEN", "PHP", "PLN", "PYG", "RON", "RUB", "SAR", "SEK", "SGD", "SVC",
"THB", "TRY", "TTD", "TWD", "UAH", "USD", "USD", "UYP", "VEF", "VND",
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",
"PLN", "RON", "RSD", "RUB", "SEK", "TRY", "UAH", "USD", "XAU", "XDR",
"ZAR"]
PL_NBP_supported_currency_array = ['AUD', 'BGN', 'BRL', 'CAD', 'CHF', 'CLP',
'CNY', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HRK', 'HUF', 'IDR', 'ILS',
'INR', 'ISK', 'JPY', 'KRW', 'LTL', 'MXN', 'MYR', 'NOK', 'NZD', 'PHP',
'PLN', 'RON', 'RUB', 'SEK', 'SGD', 'THB', 'TRY', 'UAH', 'USD', 'XDR',
'ZAR']
CA_BOC_supported_currency_array = [
"AED", "ANG", "ARS", "AUD", "BOC", "BRL", "BSD", "CHF", "CLP", "CNY",
"COP", "CZK", "DKK", "EUR", "FJD", "GBP", "GHS", "GTQ", "HKD", "HNL",
"HRK", "HUF", "IDR", "ILS", "INR", "ISK", "JMD", "JPY", "KRW", "LKR",
"MAD", "MMK", "MXN", "MYR", "NOK", "NZD", "PAB", "PEN", "PHP", "PKR",
"PLN", "RON", "RSD", "RUB", "SEK", "SGD", "THB", "TND", "TRY", "TTD",
"TWD", "USD", "VEF", "VND", "XAF", "XCD", "XPF", "ZAR"]
CH_ADMIN_supported_currency_array = [
"AED", "ALL", "ARS", "AUD", "AZN", "BAM", "BDT", "BGN", "BHD", "BRL",
"CAD", "CHF", "CLP", "CNY", "COP", "CRC", "CZK", "DKK", "DOP", "EGP",
"ETB", "EUR", "GBP", "GTQ", "HKD", "HNL", "HRK", "HUF", "IDR", "ILS",
"INR", "ISK", "JPY", "KES", "KHR", "KRW", "KWD", "KYD", "KZT", "LBP",
"LKR", "LTL", "LVL", "LYD", "MAD", "MUR", "MXN", "MYR", "NGN", "NOK",
"NZD", "OMR", "PAB", "PEN", "PHP", "PKR", "PLN", "QAR", "RON", "RSD",
"RUB", "SAR", "SEK", "SGD", "THB", "TND", "TRY", "TWD", "TZS", "UAH",
"USD", "UYU", "VEF", "VND", "ZAR"]
ECB_supported_currency_array = [
"AUD", "BGN", "BRL", "CAD", "CHF", "CNY", "CZK", "DKK", "GBP", "HKD",
"HRK", "HUF", "IDR", "ILS", "INR", "JPY", "KRW", "LTL", "MXN", "MYR",
"NOK", "NZD", "PHP", "PLN", "RON", "RUB", "SEK", "SGD", "THB", "TRY",
"USD", "ZAR"]
MX_BdM_supported_currency_array = [
"ARS", "AUD", "BBD", "BMD", "BOB", "BRL", "BSD", "BZD", "CAD", "CHF",
"CLP", "CNH", "CNY", "COP", "CRC", "CUP", "CZK", "DKK", "DOP", "DZD",
"EGP", "ESD", "EUR", "FJD", "GBP", "GTQ", "GYD", "HKD", "HNL", "HUF",
"IDR", "ILS", "INR", "IQD", "JMD", "JPY", "KES", "KRW", "KWD", "MAD",
"MYR", "NGN", "NIC", "NOK", "NZD", "PAB", "PEN", "PHP", "PLN", "PYG",
"RON", "RUB", "SAR", "SEK", "SGD", "SVC", "THB", "TRY", "TTD", "TWD",
"UAH", "USD", "USD", "UYP", "VEF", "VND", "ZAR"]
PL_NBP_supported_currency_array = [
"AUD", "BGN", "BRL", "CAD", "CHF", "CLP", "CNY", "CZK", "DKK", "EUR",
"GBP", "HKD", "HRK", "HUF", "IDR", "ILS", "INR", "ISK", "JPY", "KRW",
"LTL", "MXN", "MYR", "NOK", "NZD", "PHP", "PLN", "RON", "RUB", "SEK",
"SGD", "THB", "TRY", "UAH", "USD", "XDR", "ZAR"]
class Currency_rate_update_service(models.Model):
@@ -118,12 +121,13 @@ class Currency_rate_update_service(models.Model):
def _check_interval_number(self):
if self.interval_number < 0:
raise Warning(_('Interval number must be >= 0'))
@api.onchange('interval_number')
def _onchange_interval_number(self):
if self.interval_number == 0:
self.note = "%s Service deactivated. Currencies will no longer be updated. \n%s" % (
fields.Datetime.now(), self.note and self.note or '')
self.note = "%s Service deactivated. Currencies will no longer "
"be updated. \n%s" % (fields.Datetime.now(),
self.note and self.note or '')
@api.onchange('service')
def _onchange_service(self):
@@ -245,8 +249,9 @@ class Currency_rate_update_service(models.Model):
main_curr.name,
self.max_delta_days
)
rate_name = fields.Datetime.to_string(datetime.utcnow().replace(
hour=0, minute=0, second=0, microsecond=0))
rate_name = fields.Datetime.to_string(
datetime.utcnow().replace(hour=0, minute=0,
second=0, microsecond=0))
for curr in self.currency_to_update:
if curr.id == main_curr.id:
continue

View File

@@ -19,14 +19,6 @@
#
##############################################################################
from update_service_ECB import ECB_getter
from update_service_YAHOO import YAHOO_getter
from update_service_CA_BOC import CA_BOC_getter
from update_service_CH_ADMIN import CH_ADMIN_getter
from update_service_MX_BdM import MX_BdM_getter
from update_service_PL_NBP import PL_NBP_getter
from update_service_RO_BNR import RO_BNR_getter
class AbstractClassError(Exception):
def __str__(self):

View File

@@ -27,6 +27,7 @@ from openerp.exceptions import except_orm
_logger = logging.getLogger(__name__)
class AbstractClassError(Exception):
def __str__(self):
return 'Abstract Class'
@@ -60,7 +61,8 @@ class UnsuportedCurrencyError(Exception):
def __repr__(self):
return 'Unsupported currency %s' % self.curr
class Currency_getter_interface(object):
"Abstract class of currency getter"
@@ -135,8 +137,8 @@ class Currency_getter_interface(object):
# We always have a warning when rate_date != today
if rate_date.date() != datetime.today().date():
rate_date_str = fields.Date.to_string(rate_date)
msg = "The rate timestamp %s is not today's date %s" % (
rate_date_str, fields.Date.today())
rate_date_str = fields.Date.to_string(rate_date)
msg = "The rate timestamp %s is not today's date %s" %
(rate_date_str, fields.Date.today())
self.log_info = ("\n WARNING : %s") % msg
_logger.warning(msg)