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"), "type_id": fields.Many2One("clinic.patient.type","Type",search=True,required=True), "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()