class RequestPatientLabTestStart(ModelView):
    'Request Patient Lab Test Start'
    _name = 'medical.patient.lab.test.request.start'

    date = fields.DateTime('Date')
    patient = fields.Many2One('medical.patient', 'Patient', required=True)
    doctor = fields.Many2One('medical.medicalprofessional', 'Doctor',
        help="Doctor who Request the lab tests.")
    tests = fields.Many2Many('medical.request-test', 'request', 'test',
        'Tests', required=True)
    urgent = fields.Boolean('Urgent')

    @staticmethod
    def default_date():
        return datetime.now()

    @staticmethod
    def default_patient():
        if Transaction().context.get('active_model') == 'medical.patient':
            return Transaction().context.get('active_id')

    @staticmethod
    def default_doctor():
        pool = Pool()
        HealthProf= pool.get('medical.medicalprofessional')
        hp = HealthProf.get_medical_professional()
        if not hp:
            RequestPatientLabTestStart.raise_user_error(
                "No medical professional associated to this user !")
        return hp
Example #2
0
class Subject(models.Model):
    _name = 'member.subject'

    name = fields.Char(string='Subject Name')
    description = fields.Text()
    instructor_id = fields.Many2Many('res.partner',
                                     string='Instruktur',
                                     domain=[
                                         '|', ('instructor', '=', True),
                                         ('category_id.name', 'ilike',
                                          'Pengajar')
                                     ])
Example #3
0
class conductor(models.Model):
    _inherit = 'base.entidad'
    _name = 'flotas.conductor'

    name = fields.Char(string='nombre',
                       required=True,
                       help='nombre del conductor')
    dni = fields.Char(string='DNI', required=True, help='DNI del conductor')
    # En el conductor referencia a vehiculos
    vehiculos_ids = fields.Many2Many('flotas.vehiculo',
                                     ondelete='set null',
                                     string="vehiculos",
                                     index=True)
Example #4
0
class vehiculo(models.Model):
    _name = 'flotas.vehiculo'

    marca = fields.Char(string='marca', required=True, help='marca')
    color = fields.Selection(selection=[('1',
                                         'Blanco'), ('2',
                                                     'Gris'), ('3', 'Negro')])
    numasientos = fields.Char(string='asientos',
                              required=True,
                              help='asientos')
    # Varios coche varios conductores
    conductores_ids = fields.Many2Many('flotas.conductor', string="conductor")
    # Un coche varios viajes
    viajes_ids = fields.One2Many('flotas.viaje', string="viajes")
Example #5
0
class Usuarios(models.Model):
    _name = 'technician.usuarios'
    _description = 'tablad de usuarios'
    name = fields.Char(string='Nombre', required=True)
    email = fields.Char(string='Email', required=True)
    password = fields.Char(string='ContraseƱa')
    phone = fields.Char(string='Telefono')
    rol_id = fields.one2Many(comodel_name='technician.rol', string='Userrol')
    dept_id = fields.one2Many(comodel_name='technician.dept',
                              string='Department')
    task_ids = fields.Many2Many(comodel_name="technician_task",
                                relation="technician_x_task",
                                column1="user_id",
                                column2="task_id",
                                string="Tareas")
Example #6
0
class RequestPatientImagingTestStart(models.TransientModel):
    'Request Patient Imaging Test Start'
    _name = 'gnuhealth.patient.imaging.test.request.start'

    date = fields.Datetime('Date', default=Datetime.now())
    patient = fields.Many2one('gnuhealth.patient', 'Patient', required=True)
    doctor = fields.Many2one('gnuhealth.healthprofessional',
                             'Doctor',
                             required=True,
                             help="Doctor who Request the lab tests.")
    tests = fields.Many2Many('gnuhealth.request-imaging-test',
                             'request',
                             'test',
                             'Tests',
                             required=True)
    urgent = fields.Boolean('Urgent')

    def default_doctor(self):
        HealthProf = self.env.get('gnuhealth.healthprofessional')
        hp = HealthProf.get_health_professional()
        if not hp:
            RequestPatientImagingTestStart.raise_user_error(
                "No health professional associated to this user !")
        return hp