Fix allow_mail_archived_partner causing system notifications to send emails
This commit is contained in:
@@ -38,16 +38,9 @@ class AccountInvoiceSend(models.TransientModel):
|
||||
def action_send_and_print(self):
|
||||
_logger.error("🔥🔥🔥 ACCOUNT.INVOICE.SEND action_send_and_print CALLED 🔥🔥🔥")
|
||||
_logger.error(f"🔥 Wizard ID: {self.id}")
|
||||
_logger.error(f"🔥 Partner IDs: {self.partner_ids.ids}")
|
||||
_logger.error(f"🔥 Current context: {dict(self.env.context)}")
|
||||
|
||||
# CRITICAL: Get the actual partner email for logging
|
||||
if self.partner_ids:
|
||||
for partner in self.partner_ids:
|
||||
_logger.error(f"🔥 Wizard partner: {partner.id} - {partner.name}, active={partner.active}, email={partner.email}")
|
||||
_logger.error(f"🔥 Partner IDs: {self.partner_ids.ids}") # This returns a list of IDs
|
||||
|
||||
# Call parent with context AND ensure partner_ids are passed
|
||||
# We need to pass partner_ids to the message_post call
|
||||
return super(
|
||||
AccountInvoiceSend,
|
||||
self.with_context(
|
||||
@@ -56,7 +49,7 @@ class AccountInvoiceSend(models.TransientModel):
|
||||
mail_notify_force=True,
|
||||
force_email=True,
|
||||
mark_invoice_as_sent=True,
|
||||
# Add partner_ids to context so mail_thread can access them
|
||||
# Pass simple list of IDs, NOT ORM tuple format
|
||||
invoice_partner_ids=self.partner_ids.ids if self.partner_ids else [],
|
||||
)
|
||||
).action_send_and_print()
|
||||
|
||||
Reference in New Issue
Block a user