def send_reservation_maill(self):
        '''
        This function opens a window to compose an email,
        template message loaded by default.
        @param self: object pointer
        '''
        assert len(self._ids) == 1, 'This is for a single id at a time.'
        ir_model_data = self.env['ir.model.data']
        try:
            template_id = (ir_model_data.get_object_reference
                           ('hotel_reservation',
                            'mail_template_hotel_reservation')[1])
        except ValueError:
            template_id = False
        try:
            compose_form_id = (ir_model_data.get_object_reference
                               ('mail',
                                'email_compose_message_wizard_form')[1])
        except ValueError:
            compose_form_id = False
        ctx = dict()
        ctx.update({
            'default_model': 'hotel.reservation',
            'default_res_id': self._ids[0],
            'default_use_template': bool(template_id),
            'default_template_id': template_id,
            'default_composition_mode': 'comment',
            'force_send': True,
            'mark_so_as_sent': True
        })
        return {
            'type': 'ir.actions.act_window',
            'view_type': 'form',
            'view_mode': 'form',
            'res_model': 'mail.compose.message',
            'views': [(compose_form_id, 'form')],
            'view_id': compose_form_id,
            'target': 'new',
            'context': ctx,
            'force_send': True
        }
def send_reservation_maill ( self ) : assert len ( self . _ids ) == 1 , 'This is for a single id at a time.' ir_model_data = self . env [ 'ir.model.data' ] try : template_id = ( ir_model_data . get_object_reference ( 'hotel_reservation' , 'mail_template_hotel_reservation' ) [ 1 ] ) except ValueError : template_id = False try : compose_form_id = ( ir_model_data . get_object_reference ( 'mail' , 'email_compose_message_wizard_form' ) [ 1 ] ) except ValueError : compose_form_id = False ctx = dict ( ) ctx . update ( { 'default_model' : 'hotel.reservation' , 'default_res_id' : self . _ids [ 0 ] , 'default_use_template' : bool ( template_id ) , 'default_template_id' : template_id , 'default_composition_mode' : 'comment' , 'force_send' : True , 'mark_so_as_sent' : True } ) return { 'type' : 'ir.actions.act_window' , 'view_type' : 'form' , 'view_mode' : 'form' , 'res_model' : 'mail.compose.message' , 'views' : [ ( compose_form_id , 'form' ) ] , 'view_id' : compose_form_id , 'target' : 'new' , 'context' : ctx , 'force_send' : True }
This function opens a window to compose an email,
        template message loaded by default.
        @param self: object pointer