Skip to content

Commit f7d7efa

Browse files
committed
[FIX] l10n_it_fatturapa_pec: avoid changing email on user when testing smtp connection
1 parent 3f78a26 commit f7d7efa

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

l10n_it_fatturapa_pec/models/ir_mail_server.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@ class IrMailServer(models.Model):
1111
is_fatturapa_pec = fields.Boolean("E-invoice PEC server")
1212
email_from_for_fatturaPA = fields.Char("Sender Email Address")
1313

14-
def test_smtp_connection(self):
15-
for server in self:
16-
if server.is_fatturapa_pec:
17-
# self.env.user.email is used to test SMTP connection
18-
server.env.user.email = server.email_from_for_fatturaPA
19-
# no need to revert to correct email: UserError is always raised and
20-
# rollback done
21-
return super().test_smtp_connection()
14+
def _get_test_email_addresses(self):
15+
email_from, email_to = super()._get_test_email_addresses()
16+
if self.is_fatturapa_pec:
17+
email_from = self.email_from_for_fatturaPA
18+
return email_from, email_to
2219

2320
@api.model
2421
def _search(

0 commit comments

Comments
 (0)