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
This commit is contained in:
Cédric Krier committed 2022-05-07 11:00:04 +02:00
1 parent c151a1e087
commit fccc2e1de6
1 file changed
+2 -3
+2 -3
View File
@@ -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):