Skip to content

Commit 2f92baf

Browse files
author
KHALID SAHIH
committed
[FIX] mail_server_manager: Fix all OCA pylint errors and update translations
- Fix W8301: use named placeholders for all translation strings - Fix W8120: replace positional placeholders with named ones - Fix W8161: use self.env._ instead of _ for translations - Fix W8113: remove redundant string attributes on fields - Fix W8163: add limit to search([]) calls - Fix XML: remove deprecated data node, add no_reset_password context - Update .pot and fr.po translation files
1 parent 2d4b3a7 commit 2f92baf

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

mail_server_manager/models/mail_mail.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
from datetime import date
55

6-
from odoo import _, api, models
6+
from odoo import api, models
77
from odoo.exceptions import UserError
88
from odoo.tools import formataddr
99

@@ -135,11 +135,11 @@ def _check_email_limit(self, mail_account):
135135

136136
if mail_account.emails_sent_today >= limit:
137137
raise UserError(
138-
_(
139-
"Daily email limit reached (%s emails). "
138+
self.env._(
139+
"Daily email limit reached (%(limit)s emails). "
140140
"Please try again tomorrow or contact your administrator."
141141
)
142-
% limit
142+
% {"limit": limit}
143143
)
144144

145145
return True

mail_server_manager/wizards/change_password_wizard.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import logging
44

5-
from odoo import _, api, fields, models
5+
from odoo import api, fields, models
66
from odoo.exceptions import UserError, ValidationError
77

88
_logger = logging.getLogger(__name__)
@@ -33,11 +33,9 @@ class ChangeMailPasswordWizard(models.TransientModel):
3333
help="Enter your current Odoo password to verify your identity.",
3434
)
3535
new_mail_password = fields.Char(
36-
string="New Mail Password",
3736
help="Leave empty to auto-generate a secure password.",
3837
)
3938
confirm_mail_password = fields.Char(
40-
string="Confirm New Password",
4139
help="Re-enter the new password to confirm.",
4240
)
4341
generated_password = fields.Char(
@@ -205,7 +203,7 @@ def action_change_password(self):
205203
self.ensure_one()
206204

207205
if self.state != "change":
208-
raise UserError(_("Please verify your identity first."))
206+
raise UserError(self.env._("Please verify your identity first."))
209207

210208
mail_account = self.mail_account_id.sudo()
211209

mail_server_manager/wizards/password_wizard.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Part of Odoo. See LICENSE file for full copyright and licensing details.
22

3-
from odoo import _, fields, models
3+
from odoo import fields, models
44

55

66
class PasswordDisplayWizard(models.TransientModel):
@@ -37,8 +37,10 @@ def action_copy_password(self):
3737
"type": "ir.actions.client",
3838
"tag": "display_notification",
3939
"params": {
40-
"title": _("Password Copied"),
41-
"message": _("Password copied to clipboard. Please store it securely."),
40+
"title": self.env._("Password Copied"),
41+
"message": self.env._(
42+
"Password copied to clipboard. Please store it securely."
43+
),
4244
"type": "success",
4345
"sticky": False,
4446
},

0 commit comments

Comments
 (0)