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
class RequestTest(ModelView): 'Request - Test' _name = 'medical.request-test' _table = 'medical_request_test' request = fields.Many2One('medical.patient.lab.test.request.start', 'Request', required=True) test = fields.Many2One('medical.lab.test_type', 'Test', required=True)
class Airline(models.Model): _name = 'aline_db.airline' name = fields.Char('Name', required=True) airline_id = fields.Many2One('res.partner',string="Airline", required=True) country_id = fields.Many2One(string="Country", related="airline_id.country_id" ,readonly=True, store=True) iata_member = fields.Boolean(string="IATA Membership") alliance = fields.Many2One('aline_db.alliance', string="Alliance") service_type = fields.Selection(string="Service Type", selection[('Low Cost'),('Premium Charter'), ('Standart'), ('Domestic'), ('Charter') ]) flag_carrier = fields.Boolean(string="Flag Carrier") aircraft_no = fields.Integer(string="Number of Aircraft") revenue_total = fields.Float(string="Total Revenue") revenue_ancillary = fields.Float(string="Ancillary Revenue") @api.onchange('airline_id') def _country_id_(self): self.country_id = self.airline_id.country_id
class ResCompany(models.Model): _inherit = 'res.company' @api.model def get_property_product_pricelist(self): return self.env['ir.property'].with_context(force_company=self.id).get( 'property_product_pricelist', 'res.partner') property_product_pricelist = fields.Many2One( comodel_name='product.pricelist', string='Pricelist', default=get_property_product_pricelist, store=False)
class Skill(models.Model): _name = 'paranoia.skill' _description = 'Skill' name = fields.Char('Name') skill_template_id = fields.Many2one('paranoia.skill.template', 'Skill Template', required=True) character_id = fields.Many2one('paranoia.character', 'Character', required=True) attribute_id = fields.Many2One('paranoia.attribute', 'Attribute') value = fields.Integer('Value', default=0)
class viaje(models.Model): _name = 'flotas.viaje' vehiculo_id = fields.Many2One('flotas.vehiculo', ondelete='set null', string="vehiculo", index=True) origen = fields.One2Many('flotas.provincia', ondelete='set null', string="provincia origen") destino = fields.One2Many('flotas.provincia', ondelete='set null', string="provincia destino") tiempodeviaje = fields.Date(string='tiempo de viaje', required=True) horas = fields.Char(string='horas', required=True, help='horas de viaje')
class aulas(): _name = 'aulas.aula' nombre = fields.Char(string='nombre') ciclo = fields.one2many('ciclos.ciclo') ordenadores = fields.Many2One('ordenadores.ordenador', 'aula')
class participacion_ciclista_jon(models.Model): _name = "participacion.ciclista_jon" nombrep = fields.Many2one(comodel_name="prueba.ciclista_jon") nombree = fields.Many2One(comodel_name="equipo.ciclista_jon") puesto = fields.Integer()