[IMP] hr_timesheet: Allow to cancel entry when using the timer on a task

Prupose of the task is, if the user misclicks on the 'start' button to
launch the timer, he doesn't have any option to discard the timer.

So in this commit , added a 'delete' button so user can stop the timer
from wizard.

closes odoo/odoo#57316

Taskid: 2334036
Related: odoo/enterprise#13072
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Mithilesh Rao
2020-09-10 12:51:30 +00:00
committed by Barad Mahendra
parent 9f7bf7f619
commit 6f0458147f
2 changed files with 5 additions and 1 deletions
@@ -30,3 +30,6 @@ class ProjectTaskCreateTimesheet(models.TransientModel):
}
self.task_id.user_timer_id.unlink()
return self.env['account.analytic.line'].create(values)
def action_delete_timesheet(self):
self.task_id.user_timer_id.unlink()
@@ -13,7 +13,8 @@
</group>
<footer>
<button string="Save" type="object" name="save_timesheet" class="btn btn-primary"/>
<button string="Cancel" special="cancel" type="object" class="btn btn-secondary"/>
<button string="Delete" type="object" name="action_delete_timesheet" class="btn btn-secondary"/>
<button string="Discard" special="cancel" type="object" class="btn btn-secondary"/>
</footer>
</form>
</field>