Files
odoo_source/addons/sale_timesheet/tests/__init__.py
T
Hugo Carlier (Huca) 43bb9e18b5 [FIX] sale_timesheet: avoid access error for timesheets in project sharing
Steps
=====
- Install sale_timesheet
- Create a project shared (in edition) with a portal user
- Creata a task with a subtask and log timesheets for the subtask
- As a portal user open the parent task form
- Go in the timesheet tab
- Click on the button "Sub-tasks Hours/Days Spent" at the bottom of the
  page

Issue
=====
An access error appears for a res.partner record.

Cause
=====
https://github.com/odoo/odoo/pull/135528 introduced the field
allowed_so_line_ids on model account.analytic.line. This field is
computed based on the values of the field
commercial_partner_id (res.partner relation). However, portal users have
no access to res.partner records and the presence of this field in
account.analytic.line view (for timesheet) therefore raises an access
error for portal user.

Fix
===
A sudo is used in method _default_sale_line_domain to be able to fetch
the ids of the partners linked to the timesheet, even as a portal user.

task-3572112

closes odoo/odoo#139866

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-01-10 15:26:00 +00:00

20 lines
700 B
Python

# # -*- coding: utf-8 -*-
# # Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import common
from . import test_sale_timesheet
from . import test_sale_service
from . import test_project
from . import test_project_billing
from . import test_project_profitability
from . import test_reinvoice
from . import test_project_billing_multicompany
from . import test_upsell_warning
from . import test_edit_so_line_timesheet
from . import test_so_line_determined_in_timesheet
from . import test_sale_timesheet_portal
from . import test_sale_timesheet_ui
from . import test_project_pricing_type
from . import test_project_update
from . import test_sale_timesheet_accrued_entries