Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] services: avoid exporting labels of technical fields #162167

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/hr_timesheet/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class HrEmployee(models.Model):
_inherit = 'hr.employee'

has_timesheet = fields.Boolean(compute='_compute_has_timesheet', groups="hr.group_hr_user,base.group_system")
has_timesheet = fields.Boolean(compute='_compute_has_timesheet', groups="hr.group_hr_user,base.group_system", export_string_translation=False)

def _compute_has_timesheet(self):
self.env.cr.execute("""
Expand Down
6 changes: 3 additions & 3 deletions addons/hr_timesheet/models/hr_timesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ def _domain_employee_id(self):
user_id = fields.Many2one(compute='_compute_user_id', store=True, readonly=False)
employee_id = fields.Many2one('hr.employee', "Employee", domain=_domain_employee_id, context={'active_test': False},
index=True, help="Define an 'hourly cost' on the employee to track the cost of their time.")
job_title = fields.Char(related='employee_id.job_title')
job_title = fields.Char(related='employee_id.job_title', export_string_translation=False)
department_id = fields.Many2one('hr.department', "Department", compute='_compute_department_id', store=True, compute_sudo=True)
manager_id = fields.Many2one('hr.employee', "Manager", related='employee_id.parent_id', store=True)
encoding_uom_id = fields.Many2one('uom.uom', compute='_compute_encoding_uom_id')
encoding_uom_id = fields.Many2one('uom.uom', compute='_compute_encoding_uom_id', export_string_translation=False)
partner_id = fields.Many2one(compute='_compute_partner_id', store=True, readonly=False)
readonly_timesheet = fields.Boolean(string="Readonly Timesheet", compute="_compute_readonly_timesheet", compute_sudo=True)
readonly_timesheet = fields.Boolean(compute="_compute_readonly_timesheet", compute_sudo=True, export_string_translation=False)
milestone_id = fields.Many2one('project.milestone', related='task_id.milestone_id')

@api.depends('project_id', 'task_id')
Expand Down
13 changes: 7 additions & 6 deletions addons/hr_timesheet/models/project_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ class Project(models.Model):
)
analytic_account_active = fields.Boolean("Active Account", related="analytic_account_id.active", export_string_translation=False)

timesheet_ids = fields.One2many('account.analytic.line', 'project_id', 'Associated Timesheets')
timesheet_encode_uom_id = fields.Many2one('uom.uom', compute='_compute_timesheet_encode_uom_id')
timesheet_ids = fields.One2many('account.analytic.line', 'project_id', 'Associated Timesheets', export_string_translation=False)
timesheet_encode_uom_id = fields.Many2one('uom.uom', compute='_compute_timesheet_encode_uom_id', export_string_translation=False)
total_timesheet_time = fields.Integer(
compute='_compute_total_timesheet_time', groups='hr_timesheet.group_hr_timesheet_user',
help="Total number of time (in the proper UoM) recorded in the project, rounded to the unit.", compute_sudo=True)
encode_uom_in_days = fields.Boolean(compute='_compute_encode_uom_in_days')
is_internal_project = fields.Boolean(compute='_compute_is_internal_project', search='_search_is_internal_project')
string="Total number of time (in the proper UoM) recorded in the project, rounded to the unit.",
compute_sudo=True, export_string_translation=False)
encode_uom_in_days = fields.Boolean(compute='_compute_encode_uom_in_days', export_string_translation=False)
is_internal_project = fields.Boolean(compute='_compute_is_internal_project', search='_search_is_internal_project', export_string_translation=False)
remaining_hours = fields.Float(compute='_compute_remaining_hours', string='Time Remaining', compute_sudo=True)
is_project_overtime = fields.Boolean('Project in Overtime', compute='_compute_remaining_hours', search='_search_is_project_overtime', compute_sudo=True)
is_project_overtime = fields.Boolean('Project in Overtime', compute='_compute_remaining_hours', search='_search_is_project_overtime', compute_sudo=True, export_string_translation=False)
allocated_hours = fields.Float(string='Allocated Time')
effective_hours = fields.Float(string='Time Spent', compute='_compute_remaining_hours', compute_sudo=True)

Expand Down
15 changes: 7 additions & 8 deletions addons/hr_timesheet/models/project_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,20 @@ class Task(models.Model):
_inherit = "project.task"

project_id = fields.Many2one(domain="['|', ('company_id', '=', False), ('company_id', '=?', company_id), ('is_internal_project', '=', False)]")
analytic_account_active = fields.Boolean("Active Analytic Account", compute='_compute_analytic_account_active', compute_sudo=True, recursive=True)
analytic_account_active = fields.Boolean("Active Analytic Account", compute='_compute_analytic_account_active', compute_sudo=True, recursive=True, export_string_translation=False)
allow_timesheets = fields.Boolean(
"Allow timesheets",
compute='_compute_allow_timesheets', search='_search_allow_timesheets',
compute_sudo=True, readonly=True,
help="Timesheets can be logged on this task.")
compute_sudo=True, readonly=True, export_string_translation=False)
remaining_hours = fields.Float("Time Remaining", compute='_compute_remaining_hours', store=True, readonly=True, help="Number of allocated hours minus the number of hours spent.")
remaining_hours_percentage = fields.Float(compute='_compute_remaining_hours_percentage', search='_search_remaining_hours_percentage')
remaining_hours_percentage = fields.Float(compute='_compute_remaining_hours_percentage', search='_search_remaining_hours_percentage', export_string_translation=False)
effective_hours = fields.Float("Time Spent", compute='_compute_effective_hours', compute_sudo=True, store=True)
total_hours_spent = fields.Float("Total Time Spent", compute='_compute_total_hours_spent', store=True, help="Time spent on this task and its sub-tasks (and their own sub-tasks).")
progress = fields.Float("Progress", compute='_compute_progress_hours', store=True, aggregator="avg")
overtime = fields.Float(compute='_compute_progress_hours', store=True)
progress = fields.Float("Progress", compute='_compute_progress_hours', store=True, aggregator="avg", export_string_translation=False)
overtime = fields.Float(compute='_compute_progress_hours', store=True, export_string_translation=False)
subtask_effective_hours = fields.Float("Time Spent on Sub-tasks", compute='_compute_subtask_effective_hours', recursive=True, store=True, help="Time spent on the sub-tasks (and their own sub-tasks) of this task.")
timesheet_ids = fields.One2many('account.analytic.line', 'task_id', 'Timesheets')
encode_uom_in_days = fields.Boolean(compute='_compute_encode_uom_in_days', default=lambda self: self._uom_in_days())
timesheet_ids = fields.One2many('account.analytic.line', 'task_id', 'Timesheets', export_string_translation=False)
encode_uom_in_days = fields.Boolean(compute='_compute_encode_uom_in_days', default=lambda self: self._uom_in_days(), export_string_translation=False)
display_name = fields.Char(help="""Use these keywords in the title to set new tasks:\n
30h Allocate 30 hours to the task
#tags Set tags on the task
Expand Down
6 changes: 3 additions & 3 deletions addons/hr_timesheet/models/project_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
class ProjectUpdate(models.Model):
_inherit = "project.update"

display_timesheet_stats = fields.Boolean(compute="_compute_display_timesheet_stats")
display_timesheet_stats = fields.Boolean(compute="_compute_display_timesheet_stats", export_string_translation=False)
allocated_time = fields.Integer("Allocated Time", readonly=True)
timesheet_time = fields.Integer("Timesheet Time", readonly=True)
timesheet_percentage = fields.Integer(compute="_compute_timesheet_percentage")
uom_id = fields.Many2one("uom.uom", "Unit Of Measure", readonly=True)
timesheet_percentage = fields.Integer(compute="_compute_timesheet_percentage", export_string_translation=False)
uom_id = fields.Many2one("uom.uom", "Unit Of Measure", readonly=True, export_string_translation=False)

def _compute_timesheet_percentage(self):
for update in self:
Expand Down
2 changes: 1 addition & 1 deletion addons/hr_timesheet/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ResConfigSettings(models.TransientModel):
help="This will set the unit of measure used in projects and tasks.\n"
"If you use the timesheet linked to projects, don't "
"forget to setup the right unit of measure in your employees.")
is_encode_uom_days = fields.Boolean(compute='_compute_is_encode_uom_days')
is_encode_uom_days = fields.Boolean(compute='_compute_is_encode_uom_days', export_string_translation=False)
timesheet_encode_method = fields.Selection([
('hours', 'Hours / Minutes'),
('days', 'Days / Half-Days'),
Expand Down
2 changes: 1 addition & 1 deletion addons/hr_timesheet/models/uom_uom.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def _unprotected_uom_xml_ids(self):
]

# widget used in the webclient when this unit is the one used to encode timesheets.
timesheet_widget = fields.Char("Widget")
timesheet_widget = fields.Char("Widget", export_string_translation=False)
2 changes: 1 addition & 1 deletion addons/hr_timesheet/report/project_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ReportProjectTaskUser(models.Model):
remaining_hours = fields.Float('Time Remaining', readonly=True)
remaining_hours_percentage = fields.Float('Time Remaining Percentage', readonly=True)
progress = fields.Float('Progress', aggregator='avg', readonly=True)
overtime = fields.Float(readonly=True)
overtime = fields.Float(readonly=True, export_string_translation=False)
total_hours_spent = fields.Float("Total Time Spent", help="Time spent on this task, including its sub-tasks.")
subtask_effective_hours = fields.Float("Time Spent on Sub-Tasks", help="Time spent on the sub-tasks (and their own sub-tasks) of this task.")

Expand Down
6 changes: 3 additions & 3 deletions addons/hr_timesheet/wizard/hr_employee_delete_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class HrEmployeDeleteWizard(models.TransientModel):
_name = 'hr.employee.delete.wizard'
_description = 'Employee Delete Wizard'

employee_ids = fields.Many2many('hr.employee', string='Employees', context={'active_test': False})
has_active_employee = fields.Boolean(string='Has Active Employee', compute='_compute_has_active_employee')
has_timesheet = fields.Boolean(string='Has Timesheet', compute='_compute_has_timesheet', compute_sudo=True)
employee_ids = fields.Many2many('hr.employee', string='Employees', context={'active_test': False}, export_string_translation=False)
has_active_employee = fields.Boolean(string='Has Active Employee', compute='_compute_has_active_employee', export_string_translation=False)
has_timesheet = fields.Boolean(string='Has Timesheet', compute='_compute_has_timesheet', compute_sudo=True, export_string_translation=False)

@api.depends('employee_ids')
def _compute_has_timesheet(self):
Expand Down
4 changes: 2 additions & 2 deletions addons/project/models/account_analytic_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class AccountAnalyticAccount(models.Model):
_inherit = 'account.analytic.account'
_description = 'Analytic Account'

project_ids = fields.One2many('project.project', 'analytic_account_id', string='Projects')
project_count = fields.Integer("Project Count", compute='_compute_project_count')
project_ids = fields.One2many('project.project', 'analytic_account_id', string='Projects', export_string_translation=False)
project_count = fields.Integer("Project Count", compute='_compute_project_count', export_string_translation=False)

@api.depends('project_ids')
def _compute_project_count(self):
Expand Down
2 changes: 1 addition & 1 deletion addons/project/models/digest_digest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Digest(models.Model):
_inherit = 'digest.digest'

kpi_project_task_opened = fields.Boolean('Open Tasks')
kpi_project_task_opened_value = fields.Integer(compute='_compute_project_task_opened_value')
kpi_project_task_opened_value = fields.Integer(compute='_compute_project_task_opened_value', export_string_translation=False)

def _compute_project_task_opened_value(self):
if not self.env.user.has_group('project.group_project_user'):
Expand Down
4 changes: 2 additions & 2 deletions addons/project/models/project_collaborator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class ProjectCollaborator(models.Model):
_name = 'project.collaborator'
_description = 'Collaborators in project shared'

project_id = fields.Many2one('project.project', 'Project Shared', domain=[('privacy_visibility', '=', 'portal')], required=True, readonly=True)
project_id = fields.Many2one('project.project', 'Project Shared', domain=[('privacy_visibility', '=', 'portal')], required=True, readonly=True, export_string_translation=False)
partner_id = fields.Many2one('res.partner', 'Collaborator', required=True, readonly=True)
partner_email = fields.Char(related='partner_id.email')
partner_email = fields.Char(related='partner_id.email', export_string_translation=False)

_sql_constraints = [
('unique_collaborator', 'UNIQUE(project_id, partner_id)', 'A collaborator cannot be selected more than once in the project sharing access. Please remove duplicate(s) and try again.'),
Expand Down
14 changes: 7 additions & 7 deletions addons/project/models/project_milestone.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ def _get_default_project_id(self):
project_id = fields.Many2one('project.project', required=True, default=_get_default_project_id, ondelete='cascade')
deadline = fields.Date(tracking=True, copy=False)
is_reached = fields.Boolean(string="Reached", default=False, copy=False)
reached_date = fields.Date(compute='_compute_reached_date', store=True)
task_ids = fields.One2many('project.task', 'milestone_id', 'Tasks')
reached_date = fields.Date(compute='_compute_reached_date', store=True, export_string_translation=False)
task_ids = fields.One2many('project.task', 'milestone_id', 'Tasks', export_string_translation=False)

# computed non-stored fields
is_deadline_exceeded = fields.Boolean(compute="_compute_is_deadline_exceeded")
is_deadline_future = fields.Boolean(compute="_compute_is_deadline_future")
task_count = fields.Integer('# of Tasks', compute='_compute_task_count', groups='project.group_project_milestone')
done_task_count = fields.Integer('# of Done Tasks', compute='_compute_task_count', groups='project.group_project_milestone')
can_be_marked_as_done = fields.Boolean(compute='_compute_can_be_marked_as_done')
is_deadline_exceeded = fields.Boolean(compute="_compute_is_deadline_exceeded", export_string_translation=False)
is_deadline_future = fields.Boolean(compute="_compute_is_deadline_future", export_string_translation=False)
task_count = fields.Integer('# of Tasks', compute='_compute_task_count', groups='project.group_project_milestone, export_string_translation=False')
done_task_count = fields.Integer('# of Done Tasks', compute='_compute_task_count', groups='project.group_project_milestone', export_string_translation=False)
can_be_marked_as_done = fields.Boolean(compute='_compute_can_be_marked_as_done', export_string_translation=False)

@api.depends('is_reached')
def _compute_reached_date(self):
Expand Down