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!")Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Projekt
- MRP
To pytanie dostało ostrzeżenie
@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:
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj się| Powiązane posty | Odpowiedzi | Widoki | Czynność | |
|---|---|---|---|---|
|
If condition in a model (Error) - Odoo 11
Rozwiązane
|
|
1
cze 19
|
3988 | |
|
|
0
cze 20
|
4668 | ||
|
|
1
maj 19
|
4366 | ||
|
|
2
lip 24
|
15151 | ||
|
|
1
lip 21
|
9285 |