コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
3992 ビュー
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:

アバター
破棄
関連投稿 返信 ビュー 活動
1
6月 19
3285
0
6月 20
3987
1
5月 19
3645
2
7月 24
14111
1
7月 21
8311