An error occurred while fetching folder content.
root
authored
Before this commit if you would call get_interval() with a wrong interval type'
the function would crash and cause a traceback.
This was due to the result being returned while it is only initialized in the if statements.
If you would for example do get_interval('year') or another option/typo the 'result' was never initialized.
This was especially an issue and annoying to figure out on mail templates as the render would fail with a message saying
'Failed to render template: local variable 'result' referenced before assignment'.
The only way to find/debug this is by looking in the logs and then figuring out it came from this function.
This commit solves this by preventing a crash if you provide a non-supported interval (by returning '')
closes odoo/odoo#99908
Signed-off-by:
Martin Trigaux (mat) <mat@odoo.com>
Name | Last commit | Last update |
---|