changeset 005593cfc667 in modules/currency:default details: https://hg.tryton.org/modules/currency?cmd=changeset&node=005593cfc667 description: 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 diffstat: currency.py | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diffs (22 lines): diff -r c4dc5eac8c9c -r 005593cfc667 currency.py --- a/currency.py Mon May 02 16:43:10 2022 +0200 +++ b/currency.py Sat May 07 11:00:04 2022 +0200 @@ -299,7 +299,8 @@ __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 @@ cls._buttons.update({ 'run': {}, }) - if CurrencyRates: - cls.source.selection.append(('ecb', "European Central Bank")) @classmethod def default_frequency(cls):