From fccc2e1de669532393974895f14bb51fda4a0572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 7 May 2022 11:00:04 +0200 Subject: [PATCH] Set ecb source in the field definition instead of __setup__ Modifying a field in the __setup__ of the same class that defines it, may modify the field multiple times. issue11447 review417101003 --- currency.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/currency.py b/currency.py index bd080abe9a..502e02f6fb 100644 --- a/currency.py +++ b/currency.py @@ -299,7 +299,8 @@ class Cron(ModelSQL, ModelView): __name__ = 'currency.cron' source = fields.Selection( - [], "Source", required=True, + [('ecb', "European Central Bank")] if CurrencyRates else [], + "Source", required=True, help="The external source for rates.") frequency = fields.Selection([ ('daily', "Daily"), @@ -337,8 +338,6 @@ class Cron(ModelSQL, ModelView): cls._buttons.update({ 'run': {}, }) - if CurrencyRates: - cls.source.selection.append(('ecb', "European Central Bank")) @classmethod def default_frequency(cls):