I need to get the id of the res_partner on the parent table.
This work:
parent.patient_case_id
But this doesn't work:
parent.patient_case_id.name.id
Creditor Model:
_name="creditor.mgmt"
_columns={
'name':fields.many2one('res.partner','Creditor\'s Name',domain=['|',('customer','=',True),('is_company','=',True)]),
}
Admission Model:
_name="his.admission"
_columns={
'name' : fields.many2one ('res.partner', 'Patient Name', required="1", domain=[('customer', '=', 1)]),
}
My Model:
_name="hospital.billing"
_columns={
'patient_case_id' : fields.many2one ('his.admission', 'Patient Admission', required=True, states={'process':[('readonly',True)], 'cancel':[('readonly',True)]}),
'creditor_id' : fields.one2many ('creditor.mgmt', 'creditor', 'Creditors' ,states={'process':[('readonly',True)], 'cancel':[('readonly',True)]},),
}
The view of my model:
<field name="patient_case_id" string="Patient Name" class="oe_patient_name"/>
<field name="creditor_id" nolabel="1">
<tree string="Creditor Lines List" version="7.0" colors="red:credit_balance == 0;red:state == False;green:state == True;" editable="top">
<field name="customer" on_change="on_change_customer(customer)" string="Customerss?" />
<field name="partner_view" invisible="1" ></field>
<field name="name" domain="[('id','=',parent.patient_case_id.name.id)]" string="Creditor's Name" required="1" options="{'always_reload':True,'m2o_dialog':false,'create':false,'create_edit':false}" ></field>
</tree>
</field>