Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4067 มุมมอง
In a dating system I need the doctor to not have an appointment on the same day and at the same time. This is my code but it does not work!

    @ api.constrains ('fconsulta', 'hconsulta', 'cdoctores')
    def _citaunica (self):
        for record in self:
            if record.hconsulta in self and record.fconsulta in self and record.cdoctores in self:
                raise exceptions.UserError ("The date must be later than today!")


อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

@Zbik dont work!


อวตาร
ละทิ้ง

You have given too little data to help us get a good answer. For example what is the fields definition?

ผู้เขียน

oh sorry, this

_name = 'centromedico.citas'

fconsulta = fields.Date(string="Fecha consulta", required=True)

hconsulta = fields.Float(string="Hora consulta", required=True)

cpaciente = fields.Many2one('centromedico.pacientes', string="Paciente", ondelete="cascade")

cdoctores = fields.Many2one('centromedico.medicos', string="Doctor/a", ondelete="cascade")

chistorial = fields.Many2one('centromedico.historialclinico', string="Historial", ondelete="cascade")

คำตอบที่ดีที่สุด

Try this:

if record.hconsulta and record.fconsulta and record.cdoctores:

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มิ.ย. 19
3330
0
มิ.ย. 20
4041
1
พ.ค. 19
3716
2
ก.ค. 24
14209
1
ก.ค. 21
8389