social icon indicating copy to clipboard operation
social copied to clipboard

[17.0]mail_composer_cc_bcc : UnboundLocalError: local variable 'res_id_to_company' referenced before assignment

Open fgenubeo opened this issue 10 months ago • 1 comments

Module

mail_composer_cc_bcc

Describe the bug

The method '_generate_template_recipients' in model 'mail.template' (models/mail_template.py) set a local variable res_id_to_company at the wrong position. Because it assign them in a if and we use it in other block of code. So it raise this error : File "/mnt/OCA-social/mail_composer_cc_bcc/models/mail_template.py", line 126, in _generate_template_recipients record_company = res_id_to_company.get(res_id) UnboundLocalError: local variable 'res_id_to_company' referenced before assignment

To Reproduce

17.0:

Steps to reproduce the behavior:

  1. Just send an email where variable 'find_or_create_partners' = False

Expected behavior Normaly, we are able to send email without error

Additional context

fgenubeo avatar Feb 14 '25 11:02 fgenubeo

Hello @fgenubeo, the method was refactored in https://github.com/OCA/social/pull/1494, worth reviewing

trisdoan avatar Feb 26 '25 02:02 trisdoan

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Aug 31 '25 12:08 github-actions[bot]