Unable to install account_dunning_email
When installing the account_dunning_email on a database that already have an existing dunning procedure created raises the following exception:
Traceback (most recent call last):
File "/home/sergi/projectes/develop/trytond/trytond/protocols/dispatcher.py", line 165, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/home/sergi/projectes/develop/trytond/trytond/wizard/wizard.py", line 287, in execute
return wizard._execute(state_name)
File "/home/sergi/projectes/develop/trytond/trytond/wizard/wizard.py", line 318, in _execute
result = self._execute(transition())
File "/home/sergi/projectes/develop/trytond/trytond/ir/module.py", line 582, in transition_upgrade
pool.init(update=update, lang=lang)
File "/home/sergi/projectes/develop/trytond/trytond/pool.py", line 155, in init
lang=lang, installdeps=installdeps)
File "/home/sergi/projectes/develop/trytond/trytond/modules/__init__.py", line 467, in load_modules
_load_modules(update)
File "/home/sergi/projectes/develop/trytond/trytond/modules/__init__.py", line 432, in _load_modules
load_module_graph(graph, pool, update, lang)
File "/home/sergi/projectes/develop/trytond/trytond/modules/__init__.py", line 244, in load_module_graph
cls.__register__(module)
File "/home/sergi/projectes/develop/trytond/trytond/modules/account_dunning/dunning.py", line 43, in __register__
super(Level, cls).__register__(module_name)
File "/home/sergi/projectes/develop/trytond/trytond/model/modelsql.py", line 161, in __register__
table.add_column(field_name, field._sql_type, default=default)
File "/home/sergi/projectes/develop/trytond/trytond/backend/postgresql/table.py", line 287, in add_column
'SET "' + column_name + '" = %s', (default(),))
File "/home/sergi/projectes/develop/trytond/trytond/model/modelsql.py", line 157, in default
field_name: cls._defaults[field_name](),
File "/home/sergi/projectes/develop/trytond/trytond/modules/account_dunning_email/account.py", line 45, in default_email_template
return Data.get_id('account_dunning_email', 'report_email')
File "/home/sergi/projectes/develop/trytond/trytond/ir/model.py", line 1095, in get_id
% ".".join([module, fs_id]))
KeyError: 'Reference to account_dunning_email.report_email not found'
That's because it tries to set the email_template for existing rows to a value that it's not loaded to the database.