晚上好,您能帮我解决一个问题,让我听到您说因为已经很忙而不能花一个小时吗?,我目前有:

class reserva (models.Model):

     _name='gimnasio.reserva'

     tipo_reserva=fields.Selection([('clase','Clase'),('evaluacion','Evaluacion')])

     fecha_reserva=fields.Date()

     start_time=fields.Float()

     end_time=fields.Float()

     def fecha(self):

          if self.star_time==self.star_time:

               raise validationError('the hour is busy')

最佳答案

I have another question for you. you know how to configure Datetime only for hour and minutes because I only need hour and minutes but not the date.

仅将日期时间配置为小时和分钟。


time = fields.Datetime("time")
custom_time = fields.Char('my_custome_time')
    @api.onchange('time')
    def _get_time(self):
        if self.time:
            for rec in self:
                # datetime value is a string like 'YYYY-mm-dd HH:MM:SS'
                # so just extract string from position 11 to 16
                _time = self.time[11:16]
                self.custom_time = _time
                rec.custom_time = self.custom_time

10-02 03:17
查看更多