[FIX] {sale_}project,hr_timesheet: translate various messages

Before this commit, some error messages and others messages are
not translated.

This commit uses the translation function to be able to translate
those messages.

task-3006627

closes odoo/odoo#105192

X-original-commit: 85ef44cd66474bf5dcda4d7478d566e462d1a550
Related: odoo/enterprise#33717
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Adesh Jolhe (adjo)
2022-11-08 23:14:51 +01:00
parent 725130f8fa
commit 11ea3fd06e
9 changed files with 91 additions and 17 deletions
@@ -501,12 +501,14 @@ msgstr ""
#. module: hr_timesheet
#: code:addons/hr_timesheet/models/project.py:0
#: code:addons/hr_timesheet/models/project.py:0
#, python-format
msgid "Invalid operator: %s"
msgstr ""
#. module: hr_timesheet
#: code:addons/hr_timesheet/models/project.py:0
#: code:addons/hr_timesheet/models/project.py:0
#, python-format
msgid "Invalid value: %s"
msgstr ""
@@ -937,6 +939,12 @@ msgstr ""
msgid "This month"
msgstr ""
#. module: hr_timesheet
#: code:addons/hr_timesheet/models/project.py:0
#, python-format
msgid "This operator %s is not supported in this search method."
msgstr ""
#. module: hr_timesheet
#: code:addons/hr_timesheet/models/project.py:0
#, python-format
+3 -3
View File
@@ -65,9 +65,9 @@ class Project(models.Model):
@api.model
def _search_is_internal_project(self, operator, value):
if not isinstance(value, bool):
raise ValueError('Invalid value: %s' % (value))
raise ValueError(_('Invalid value: %s', value))
if operator not in ['=', '!=']:
raise ValueError('Invalid operator: %s' % (operator))
raise ValueError(_('Invalid operator: %s', operator))
query = """
SELECT C.internal_project_id
@@ -300,7 +300,7 @@ class Task(models.Model):
def _search_remaining_hours_percentage(self, operator, value):
if operator not in OPERATOR_MAPPING:
raise NotImplementedError('This operator %s is not supported in this search method.' % operator)
raise NotImplementedError(_('This operator %s is not supported in this search method.', operator))
query = f"""
SELECT id
FROM {self._table}
+66
View File
@@ -2546,12 +2546,26 @@ msgid ""
"Tracker module is installed)."
msgstr ""
#. module: project
#. openerp-web
#: code:addons/project/static/src/project_sharing/components/chatter/chatter_messages.xml:0
#, python-format
msgid "Internal notes are only displayed to internal users."
msgstr ""
#. module: project
#: code:addons/project/report/project_task_burndown_chart_report.py:0
#, python-format
msgid "Invalid aggregation function %r."
msgstr ""
#. module: project
#: code:addons/project/report/project_task_burndown_chart_report.py:0
#: code:addons/project/report/project_task_burndown_chart_report.py:0
#, python-format
msgid "Invalid field %r on model %r"
msgstr ""
#. module: project
#: code:addons/project/report/project_task_burndown_chart_report.py:0
#, python-format
@@ -3398,6 +3412,12 @@ msgstr ""
msgid "Not Blocking"
msgstr ""
#. module: project
#: code:addons/project/models/project.py:0
#, python-format
msgid "Not Implemented."
msgstr ""
#. module: project
#: model:ir.model.fields,field_description:project.field_project_share_wizard__note
msgid "Note"
@@ -3988,6 +4008,7 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:project.portal_my_projects
#: model_terms:ir.ui.view,arch_db:project.view_project
#: model_terms:ir.ui.view,arch_db:project.view_project_calendar
#, python-format
msgid "Projects"
msgstr ""
@@ -4434,6 +4455,13 @@ msgstr ""
msgid "Saturday"
msgstr ""
#. module: project
#. openerp-web
#: code:addons/project/static/src/js/tours/project.js:0
#, python-format
msgid "Schedule your activity once it is ready."
msgstr ""
#. module: project
#. openerp-web
#: code:addons/project/static/src/js/project_task_kanban_examples.js:0
@@ -4618,6 +4646,12 @@ msgstr ""
msgid "Share Readonly"
msgstr ""
#. module: project
#: code:addons/project/models/project_task_recurrence.py:0
#, python-format
msgid "Should repeat at least once"
msgstr ""
#. module: project
#: model:ir.model.fields,field_description:project.field_project_project__is_favorite
msgid "Show Project on Dashboard"
@@ -5070,7 +5104,9 @@ msgid "Tasks Stages"
msgstr ""
#. module: project
#: code:addons/project/models/project.py:0
#: model:ir.model.fields,field_description:project.field_project_task__recurring_count
#, python-format
msgid "Tasks in Recurrence"
msgstr ""
@@ -5098,6 +5134,18 @@ msgstr ""
msgid "The current user's personal task stage."
msgstr ""
#. module: project
#: code:addons/project/models/project_task_recurrence.py:0
#, python-format
msgid "The end date should be after the day of the month"
msgstr ""
#. module: project
#: code:addons/project/models/project_task_recurrence.py:0
#, python-format
msgid "The end date should be in the future"
msgstr ""
#. module: project
#: model_terms:ir.ui.view,arch_db:project.project_update_default_description
msgid "The following milestone has been added:"
@@ -5108,6 +5156,12 @@ msgstr ""
msgid "The following milestones have been added:"
msgstr ""
#. module: project
#: code:addons/project/models/project_task_recurrence.py:0
#, python-format
msgid "The interval should be greater than 0"
msgstr ""
#. module: project
#: model:ir.model.fields,help:project.field_project_project__alias_model_id
msgid ""
@@ -5146,6 +5200,12 @@ msgstr ""
msgid "The project's start date must be before its end date."
msgstr ""
#. module: project
#: code:addons/project/models/project.py:0
#, python-format
msgid "The search does not support the %s operator or %s value."
msgstr ""
#. module: project
#: code:addons/project/models/project.py:0
#, python-format
@@ -5801,6 +5861,12 @@ msgid ""
" tasks can be transferred after this one is deleted."
msgstr ""
#. module: project
#: code:addons/project/models/project_task_recurrence.py:0
#, python-format
msgid "You should select a least one day"
msgstr ""
#. module: project
#. openerp-web
#: code:addons/project/static/src/xml/project_task_kanban_examples.xml:0
+1 -1
View File
@@ -40,7 +40,7 @@ class AccountAnalyticAccount(models.Model):
"views": [[kanban_view_id, "kanban"], [False, "form"]],
"domain": [['analytic_account_id', '=', self.id]],
"context": {"create": False},
"name": "Projects",
"name": _("Projects"),
}
if len(self.project_ids) == 1:
result['views'] = [(False, "form")]
+3 -3
View File
@@ -1696,7 +1696,7 @@ class Task(models.Model):
def _search_portal_user_names(self, operator, value):
if operator != 'ilike' and not isinstance(value, str):
raise ValidationError('Not Implemented.')
raise ValidationError(_('Not Implemented.'))
query = """
SELECT task_user.task_id
@@ -2172,7 +2172,7 @@ class Task(models.Model):
def _search_has_late_and_unreached_milestone(self, operator, value):
if operator not in ('=', '!=') or not isinstance(value, bool):
raise NotImplementedError(f'The search does not support the {operator} operator or {value} value.')
raise NotImplementedError(_('The search does not support the %s operator or %s value.', operator, value))
domain = [
('allow_milestones', '=', True),
('milestone_id', '!=', False),
@@ -2551,7 +2551,7 @@ class Task(models.Model):
def action_recurring_tasks(self):
return {
'name': 'Tasks in Recurrence',
'name': _('Tasks in Recurrence'),
'type': 'ir.actions.act_window',
'res_model': 'project.task',
'view_mode': 'tree,form,kanban,calendar,pivot,graph,activity',
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from calendar import monthrange
@@ -118,28 +118,28 @@ class ProjectTaskRecurrence(models.Model):
def _check_recurrence_days(self):
for project in self.filtered(lambda p: p.repeat_unit == 'week'):
if not any([project.mon, project.tue, project.wed, project.thu, project.fri, project.sat, project.sun]):
raise ValidationError('You should select a least one day')
raise ValidationError(_('You should select a least one day'))
@api.constrains('repeat_interval')
def _check_repeat_interval(self):
if self.filtered(lambda t: t.repeat_interval <= 0):
raise ValidationError('The interval should be greater than 0')
raise ValidationError(_('The interval should be greater than 0'))
@api.constrains('repeat_number', 'repeat_type')
def _check_repeat_number(self):
if self.filtered(lambda t: t.repeat_type == 'after' and t.repeat_number <= 0):
raise ValidationError('Should repeat at least once')
raise ValidationError(_('Should repeat at least once'))
@api.constrains('repeat_type', 'repeat_until')
def _check_repeat_until_date(self):
today = fields.Date.today()
if self.filtered(lambda t: t.repeat_type == 'until' and t.repeat_until < today):
raise ValidationError('The end date should be in the future')
raise ValidationError(_('The end date should be in the future'))
@api.constrains('repeat_unit', 'repeat_on_month', 'repeat_day', 'repeat_type', 'repeat_until')
def _check_repeat_until_month(self):
if self.filtered(lambda r: r.repeat_type == 'until' and r.repeat_unit == 'month' and r.repeat_until and r.repeat_on_month == 'date' and int(r.repeat_day) > r.repeat_until.day):
raise ValidationError('The end date should be after the day of the month')
raise ValidationError(_('The end date should be after the day of the month'))
@api.model
def _get_recurring_fields(self):
@@ -361,7 +361,7 @@ class ReportProjectTaskBurndownChart(models.AbstractModel):
fname = fname or name
field = self._fields.get(fname)
if not field:
raise ValueError("Invalid field %r on model %r" % (fname, self._name))
raise ValueError(_("Invalid field %r on model %r", (fname, self._name)))
if not (field.base_field.store and field.base_field.column_type):
raise UserError(_("Cannot aggregate field %r.", fname))
if func not in VALID_AGGREGATE_FUNCTIONS:
@@ -370,7 +370,7 @@ class ReportProjectTaskBurndownChart(models.AbstractModel):
# we have 'name', retrieve the aggregator on the field
field = self._fields.get(name)
if not field:
raise ValueError("Invalid field %r on model %r" % (name, self._name))
raise ValueError(_("Invalid field %r on model %r", (name, self._name)))
if not (field.base_field.store and
field.base_field.column_type and field.group_operator):
continue
@@ -103,7 +103,7 @@ tour.register('project_tour', {
content: Markup(_t("Create <b>activities</b> to set yourself to-dos or to schedule meetings.")),
}, {
trigger: ".modal-dialog .btn-primary",
content: "Schedule your activity once it is ready.",
content: _t("Schedule your activity once it is ready."),
position: "bottom",
run: "click",
}, {
+1 -1
View File
@@ -550,7 +550,7 @@ class ProjectTask(models.Model):
action_window = {
"type": "ir.actions.act_window",
"res_model": "sale.order",
"name": "Sales Order",
"name": _("Sales Order"),
"views": [[False, "tree"], [False, "kanban"], [False, "form"]],
"context": {"create": False, "show_sale": True},
"domain": [["id", "in", so_ids]],