Skip to Content
Menu
This question has been flagged
1 Reply
2742 Views

I wanna hide a button (start) in a template, I tried inherit or override (cannot acess anymore). Do you have any way to sovle that? 


here is code base:

<?xml version="1.0" encoding="utf-8"?>
<templates>

<div t-name="timesheet_grid.timer_header" class="d-flex align-items-center timesheet-timer py-2" owl="1">
<t t-if="_timerIsRunning">
<button class="my-2 mr-2 btn btn-primary btn_stop_timer" t-on-click="_onClickStopTimer()" t-ref="stopButton">
Stop
</button>
<div class="p-2 input_timer">
<input class="o_field_float o_field_number o_field_widget o_input input_manual_time" t-att-class="{'o_field_invalid': state.errorManualTimeInput === true}" type="text" t-att-value="timeInput"
t-on-keydown="_onKeydown" t-on-input="_onInputTimer" t-on-focusout="_onFocusoutTimer" t-ref="manualTimerInput"
t-if="_manualTimeInput"/>
<span class="px-auto font-weight-bold" id="display_timer" t-else="" t-on-click="_onClickManualTime">
<t t-esc="_timerString"/>
</span>
</div>
<div class="p-2 input_description">
<span t-if="_timerReadOnly" t-esc="props.description" class="input_description_timer"/>
<input t-else="" class="o_field_float o_field_number o_field_widget o_input input_description_timer" type="text" t-att-value="props.description" t-ref="inputDescription"
placeholder="Describe your activity..." t-on-change="_onInputDescription" t-on-keydown="_onKeydown"/>
</div>
<div t-if="_timerReadOnly" class="p-2 input_m2o d-flex flex-row justify-content-around">
<div class="px-2">
<span t-esc="props.projectName"/>
</div>
<div class="px-2">
<span t-esc="props.taskName"/>
</div>
</div>
<div t-else="" class="p-md-2 input_m2o">
<TimerHeaderM2OAdapter Component="TimerHeaderM2O" widgetArgs="[props.projectId, props.taskId, props.projectWarning]"/>
</div>
<div class="pl-md-2 py-2">
<button class="btn btn-muted px-0 stop-timer fa fa-times" t-on-click="_onUnlinkTimer" title="Press Esc to discard"/>
</div>
</t>
<t t-else="">
<div class="my-2 pr-2" id="start">
<button class="btn btn_start_timer" t-on-click="_onClickStartTimer()" t-ref="startButton"><i class="fa fa-play"></i> Start</button>
</div>
<div class="p-2">
<span t-if="timerMode"><span class="text-muted">use a hot key to</span> add <t t-esc="props.stepTimer"/> min</span>
<t t-elif="isMobile"><span class="text-muted"> or use a </span><span>hot key</span></t>
<t t-else=""><span class="text-muted">press </span><span>Enter</span><span class="text-muted"> or use a </span><span>hot key</span></t>
</div>
</t>
</div>

</templates>

Avatar
Discard
Author

this guy
<pre> <button class="btn btn_start_timer"><i class="fa fa-play"></i> Start</button></pre>

Best Answer

Hi,

We can hide the button using js :

$('.btn_start_timer').hide()

or

var element = document.getElementsByClassName('btn_start_timer');
element.classList.add('d-none');

Regards

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 22
1268
0
Jan 21
2563
2
Nov 20
10281
3
Jan 24
13212
2
Nov 19
7109