Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
4781 Vistas

I want to change the template of timesheets.


Where we find (hr_timesheet_sheet/static/src/xml/timesheet.xml)

<th t-att-class="'oe_timesheet_weekly_date_head' + (moment().format('DD-MM-YYYY') === moment(date).format('DD-MM-YYYY') ? ' oe_timesheet_weekly_today' : '')">

I want to put

<th t-att-class="'oe_timesheet_weekly_date_head' + ((date.toString('ddd') === 'Sat') || (date.toString('ddd') === 'Sun') || (Date.compare(date, Date.today()) === 0) ? ' oe_timesheet_weekly_today' : '')">


But I can't get Odoo to show any change I make. So... does anyone have a working example of a template being changed?

I find too many people giving their 2 cents without actually seing things working. I've tried the "inherit_id" in the templates tag, I've tried the same in other places, I'ves tried with no inherit_id and I'm desperate!!! :)

 


Avatar
Descartar
Mejor respuesta

You could do it like:

<t t-extend="hr_timesheet_sheet.WeeklyTimesheet">
<t t-jquery="t:first" t-operation="replace">
        <t t-foreach="widget.dates" t-as="date">
     <th t-att-class="'oe_timesheet_weekly_date_head' + ((date.toString('ddd') === 'Sat') || (date.toString('ddd') === 'Sun') || (Date.compare(date, Date.today()) === 0) ? ' oe_timesheet_weekly_today' : '')">
<t t-esc="date.toString('ddd')"/><br />
<t t-esc="date.toString('MMM d')"/>
</th>
</t> 
</t>
</t>

Hope this help you to solve your problem

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
jun 23
1809
0
jul 21
2021
1
may 17
4401
2
mar 25
4756
4
feb 25
2293