Monday, March 15, 2021
1 change · master
Resolved issues and error corrections
The sales order portal now correctly shows the View Timesheets button when timesheets are linked to a sale, even if the sale was not automatically connected to an analytic account. This helps customers and staff access relevant timesheet information without missing records due to the original service setup.
Original PR description
Before this commit, when the user creates a SO with a service product which does not generate a task or a project, the analytic account is not set on the new SO. Then even if the user creates a task…
Before this commit, when the user creates a SO with a service product which does not generate a task or a project, the analytic account is not set on the new SO. Then even if the user creates a task and add timesheets for this product in this SO, the compute_timesheet_ids gives 0 timesheets in the sale.order model because the SO is not linked to an analytic account. This commit removes this condition and directly searches the timesheets linked to the SO and thus provides the correct number of timesheets for it. This bug is appeared from this commit: dc9ef81 Steps to reproduce: 1. Create a SO and add a SOL with 'Service on Timesheet' 2. Confirm the SO 3. Create a task in project for the same customer than the SO or a project with no customer set. 4. Add the customer of the SO in the task if it is not already the case. 5. Add the SOL in the task and add a timesheet. 6. Go to /my/orders 7. Select the SO that you have created and in this view, normally, you should have the View Timesheets buttons on the left side. Current behaviour: The 'View Timesheets' button does not appear in the view because the compute_timesheet_ids from the SO return no timesheets for it. Expected behaviour: The button should be visible in the view because we have a timesheet for this SO. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr