Skip to content

Commit

Permalink
[FIX] account_invoice_mass_sending: Users have extra notifications wh…
Browse files Browse the repository at this point in the history
…en the invoice has sent by the job

TT51673
  • Loading branch information
sergio-teruel authored and jguenat committed Nov 14, 2024
1 parent ac386b4 commit bdea6c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions account_invoice_mass_sending/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def _send_invoice_individually(self, template=None):
{
"active_model": self._name,
"active_ids": self.ids,
"discard_logo_check": True,
"account_invoice_mass_sending": True,
}
)
wiz = self.env["account.invoice.send"].with_context(**wiz_ctx).create({})
Expand Down
11 changes: 10 additions & 1 deletion account_invoice_mass_sending/wizards/account_invoice_send.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, models
from odoo import _, api, models


class AccountInvoiceSend(models.TransientModel):
Expand Down Expand Up @@ -48,3 +48,12 @@ def enqueue_invoices(self):
}
)
return notification

@api.onchange("invoice_ids")
def _compute_composition_mode(self):
"""Force send as mass_mail although this module sends each invoice one by one
to avoid extra notificactions"""
if not self.env.context.get("account_invoice_mass_sending", False):
return super()._compute_composition_mode()
for wizard in self:
wizard.composer_id.composition_mode = "mass_mail"

0 comments on commit bdea6c5

Please sign in to comment.