[FIX] account: update object reference in loop

In line[1], self is referenced to _get_default_mail_attachments_widget, and
using self instead of wizard doesn't make sense because self could potentially
hold multiple values. This becomes problematic when the ensure_one method is
called. Due to this below error is raised.

Traceback : ValueError
Expected singleton: account.move.send(168, 167)

[1] : https://github.com/odoo/odoo/blob/167dedab5c7423097689c6a7d0d6ee6dd904a8bf/addons/account/wizard/account_move_send.py#L311-L312

sentry - 5234450902

closes odoo/odoo#162829

Signed-off-by: Laurent Smet (las) <las@odoo.com>
This commit is contained in:
aamo-odoo
2024-04-25 15:26:19 +00:00
parent cdfd196a0e
commit 622c018a65
+1 -1
View File
@@ -307,7 +307,7 @@ class AccountMoveSend(models.TransientModel):
if wizard.mode == 'invoice_single':
manual_attachments_data = [x for x in wizard.mail_attachments_widget or [] if x.get('manual')]
wizard.mail_attachments_widget = (
self._get_default_mail_attachments_widget(wizard.move_ids, wizard.mail_template_id)
wizard._get_default_mail_attachments_widget(wizard.move_ids, wizard.mail_template_id)
+ manual_attachments_data
)
else: