[FIX] project: translate error message in Project Sharing

Before this commit, when the user cannot write on a certain field
an error is occurred to notice the user, he cannot write on that field.
The problem is the `on` is never translated.

This commit fixes the issue to be sure the whole error message is
translated.

closes odoo/odoo#109288

X-original-commit: 5098c59cc6d1a853210f8c4f5340f0d4ee8dd883
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Csaba Tóth
2023-01-06 13:31:01 +01:00
committed by Xavier BOL (xbo)
parent 29c275c117
commit 7265228f20
2 changed files with 19 additions and 7 deletions
+14 -6
View File
@@ -5791,12 +5791,6 @@ msgstr ""
msgid "You can only set a personal stage on a private task."
msgstr ""
#. module: project
#: code:addons/project/models/project.py:0
#, python-format
msgid "You cannot %s %s fields in task."
msgstr ""
#. module: project
#: code:addons/project/models/analytic_account.py:0
#, python-format
@@ -5826,6 +5820,20 @@ msgid ""
"their tasks."
msgstr ""
#. module: project
#. odoo-python
#: code:addons/project/models/project.py:0
#, python-format
msgid "You cannot read %s fields in task."
msgstr ""
#. module: project
#. odoo-python
#: code:addons/project/models/project.py:0
#, python-format
msgid "You cannot write on %s fields in task."
msgstr ""
#. module: project
#: code:addons/project/models/project.py:0
#, python-format
+5 -1
View File
@@ -1880,7 +1880,11 @@ class Task(models.Model):
if fields and (not check_group_user or self.env.user.has_group('base.group_portal')) and not self.env.su:
unauthorized_fields = set(fields) - (self.SELF_READABLE_FIELDS if operation == 'read' else self.SELF_WRITABLE_FIELDS)
if unauthorized_fields:
raise AccessError(_('You cannot %s %s fields in task.', operation if operation == 'read' else '%s on' % operation, ', '.join(unauthorized_fields)))
if operation == 'read':
error_message = _('You cannot read %s fields in task.', ', '.join(unauthorized_fields))
else:
error_message = _('You cannot write on %s fields in task.', ', '.join(unauthorized_fields))
raise AccessError(error_message)
def read(self, fields=None, load='_classic_read'):
self._ensure_fields_are_accessible(fields)