콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
714 화면

How to add mail template to already existed inbuilt button in odoo time off. odoov15.

class res_partner(models.Model):
_inherit = 'hr.leave'
def action_validate(self):
template_id = self.env.ref('iwave_time_off.leave_approval_mail').id
print(template_id, '==============================================')
template = self.env['mail.template'].browse(template_id)
template.send_mail(self.id, force_send=True)
self.write({'state': 'validate'})
return True
after inheriting this code timesheet doesnt display time off.

please help me to solve this error.



아바타
취소
작성자 베스트 답변

Thank you. it worked.

아바타
취소
베스트 답변

Hi,

Can you update your code as follows and see if its works fine.

class HolidaysRequest(models.Model):
_inherit = 'hr.leave'

def action_validate(self):
res = super(HolidaysRequest, self).action_validate()
template = self.env.ref('iwave_time_off.leave_approval_mail')
template.send_mail(self.id, force_send=True)
return res



Thanks

아바타
취소