콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4218 화면

Hi,

I create some fields with many to one type and can't access the value on create method.

Here is the model

from odoo import models, fields, api, _ from odoo.exceptions import ValidationError

class Admission(models.Model):

    _name = 'hm.admission'


    patient_id = fields.Many2one('hm.patient', 'Patient', required=True, index=True)

    visit_id = fields.Integer('Visit No', required=True)


    card_no = fields.Char(related='patient_id.card_no', store=False, index=True)

    medical_no = fields.Char(related='patient_id.medical_no', store=False, index=True)

    age = fields.Char(related='patient_id.age', store=False, index=True)


    department_id = fields.Many2one('hr.department', 'Department')

    employee_id = fields.Many2one('hr.employee', 'Medic', domain="[('department_id', '=', department_id)]")

    admissionType = fields.Selection(

        [('outpatient', 'Outpatient'), ('inpatient', 'Inpatient'), ('newborn', 'New Born'), ('emergency', 'Emergency')],

        'Admission Type', required=True)

    state = fields.Selection([('admitted', 'Admitted'),

                              ('waiting', 'Waiting'),

                              ('ready', 'Ready'),

                              ('intreatment', 'Intreatment'),

                              ('waitingresult', 'Awaiting Result(s)'),

                              ('unsummarized', 'Unsummarized'),

                              ('inpatient', 'Inpatient'),

                              ('discharged', 'Discharged'),

                              ('closed', 'Closed')], 'Admission Status', default='admitted')

    visit_type = fields.Many2one('hm.visit.type', 'Visit Type', required=True)

    create_date = fields.Date('Admission Date', readonly=True)





아바타
취소
관련 게시물 답글 화면 활동
4
9월 15
7368
1
8월 16
11061
0
4월 24
2288
1
12월 22
6489
0
12월 19
4978