Skip to content

Conversation

@innovara
Copy link

The email_subject field is defined with default=_('Invoices Reminder'), which evaluates the translation at module load time. This triggers warnings about missing translation language and prevents proper translation at runtime.

Using default=lambda self: _('Invoices Reminder') defers evaluation until record creation, ensuring correct translation in the user’s language and removing the warning.

For reference, the warning looks like this:

WARNING innovara odoo.tools.translate: no translation language detected, skipping translation <frame at 0x7758ce5943c0, file '.../custom-addons/odoomates/om_account_followup/wizard/followup_print.py', line 34, code FollowupPrint> 
[...]
File ".../custom-addons/odoomates/om_account_followup/wizard/followup_print.py", line 34, in FollowupPrint
 default=_('Invoices Reminder'))
File ".../odoo/odoo/tools/translate.py", line 621, in get_text_alias
  module, lang = _get_translation_source(1)
File ".../odoo/tools/translate.py", line 610, in _get_translation_source
  lang = lang or _get_lang(frame, default_lang)
File ".../odoo/tools/translate.py", line 601, in _get_lang
  _logger.log(log_level, 'no translation language detected, skipping translation %s', frame, stack_info=True)

The email_subject field was defined with default=_('Invoices Reminder'),
which evaluates the translation at module load time. This triggers warnings
about missing translation language and prevents proper translation at
runtime.

Using default=lambda self: _('Invoices Reminder') defers evaluation until
record creation, ensuring correct translation in the user’s language and
removing the warning.

Signed-off-by: Manuel Fombuena <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant