Module
helpdesk_mgmt_timesheet
Describe the bug
The template helpdesk_mgmt_timesheet.timesheet_table references the undefined variable nbCols (t-value="nbCols + 1"), which was removed from the parent template hr_timesheet.timesheet_table in Odoo 17.0, causing a NameError when rendering the timesheet report with tickets.
To Reproduce
Affected versions: 17.0, 18.0, 19.0 (migration PR #999)
Steps to reproduce the behavior:
- Install
helpdesk_mgmt_timesheet on Odoo 17.0+ (or 18.0, or the 19.0 migration PR)
- Create a ticket linked to a project/task with timesheets
- As a user with
helpdesk_mgmt.group_helpdesk_user, view a timesheet line that has a ticket_id
- Try to print the timesheet report (e.g. from the ticket or project)
- The report fails to render with a NameError on
nbCols
Current behavior
The inheritance template at report/report_timesheet_templates.xml tries to increment a variable nbCols that no longer exists in the parent template:
<xpath expr="//table[hasclass('table-sm')]/tbody/tr[2]/td" position="before">
<t t-if="show_ticket"
t-set="nbCols"
t-value="nbCols + 1"
groups="helpdesk_mgmt.group_helpdesk_user"/>
</xpath>
In Odoo 17.0+, the parent template hr_timesheet.timesheet_table replaced the dynamic colspan logic (t-attf-colspan="{{nbCols}}") with a static colspan="100". Since nbCols is never defined in the parent scope, evaluating nbCols + 1 raises a NameError when show_ticket is True and the user has the helpdesk group.
This bug was introduced during the 16.0→17.0 migration, carried over to 18.0 without detection, and the current 19.0 migration PR (#999) also copies the same broken code.
Expected behavior
The 3rd xpath block (setting nbCols) should be removed, as the parent template now uses colspan="100" which spans all columns automatically. The two other xpaths (adding the Ticket column header and data cell) are sufficient and work correctly.
Additional context
Fix proposed tested successfully.
Module
helpdesk_mgmt_timesheet
Describe the bug
The template helpdesk_mgmt_timesheet.timesheet_table references the undefined variable nbCols (t-value="nbCols + 1"), which was removed from the parent template hr_timesheet.timesheet_table in Odoo 17.0, causing a NameError when rendering the timesheet report with tickets.
To Reproduce
Affected versions: 17.0, 18.0, 19.0 (migration PR #999)
Steps to reproduce the behavior:
helpdesk_mgmt_timesheeton Odoo 17.0+ (or 18.0, or the 19.0 migration PR)helpdesk_mgmt.group_helpdesk_user, view a timesheet line that has a ticket_idnbColsCurrent behavior
The inheritance template at
report/report_timesheet_templates.xmltries to increment a variablenbColsthat no longer exists in the parent template:In Odoo 17.0+, the parent template
hr_timesheet.timesheet_tablereplaced the dynamic colspan logic (t-attf-colspan="{{nbCols}}") with a staticcolspan="100". SincenbColsis never defined in the parent scope, evaluatingnbCols + 1raises aNameErrorwhen show_ticket is True and the user has the helpdesk group.This bug was introduced during the 16.0→17.0 migration, carried over to 18.0 without detection, and the current 19.0 migration PR (#999) also copies the same broken code.
Expected behavior
The 3rd xpath block (setting nbCols) should be removed, as the parent template now uses colspan="100" which spans all columns automatically. The two other xpaths (adding the Ticket column header and data cell) are sufficient and work correctly.
Additional context
Fix proposed tested successfully.