clinic/netforce_clinic/models/patient_move.py

23 lines
823 B
Python

import time
from netforce.model import Model, fields, get_model
class PatientMove(Model):
_name='clinic.patient.move'
_fields={
'patient_id': fields.Many2One("clinic.patient", "Patient", required=True, on_delete="cascade"),
"date": fields.DateTime("Date"),
"patient_name": fields.Char("Patient Name"),
"patient_type": fields.Char("Patient Type"), #ปกส. ....
"type": fields.Selection([['in','In'],['out','Out']], 'Type', required=True),
"location_from_id": fields.Many2One("stock.location", "From Location", required=False, search=True),
"location_to_id": fields.Many2One("stock.location", "To Location", required=False, search=True),
}
_defaults={
'date': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
}
PatientMove.register()