How to pass input box value to a button action function in OpenERP? - odoo

There is an input box, labeled "Original", on the popup form, containing typed value '105-0045', picture attached. Button click action code is in the function action_replace(). What is the way to pass the input box value to the button function action_replace() when the "Replace" button is clicked?
Here is my XML code where the input box is defined:
<record id="replace_all_in_BOM_form" model="ir.ui.view">
<field name="name">replace.all.in.BOM.form</field>
<field name="model">product.template</field>
<field name="priority" eval="20"/>
<field name="type">form</field>
<field name="arch" type="xml">
<label class="text-inline" for="original_name" string="Original"
></label>
<input name="original_name" id="original_id" ></input>
<group>
<field name="default_code" string="Replacement" readonly="1"
invisible="0" />
<field name="uom_id" invisible="1" />
<field name="uom_po_id" invisible="1" />
<field name="type" invisible="1" />
<field name="categ_id" invisible="1" />
<field name="name" invisible="1" />
</group>
<button type="object" string="Replace" name="action_replace" />
</field>
</record>
<record id="action5" model="ir.actions.act_window">
<field name="name">Replace all in BOM</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_type">form</field>
<field name="target">new</field>
<field name="view_id" ref="replace_all_in_BOM_form"/>
</record>
<record id="ir_BOM_structure5" model="ir.values">
<field eval="'client_action_multi'" name="key2"/>
<field eval="'product.template'" name="model"/>
<field name="name">Replace all in BOM</field>
<field eval="'ir.actions.act_window,'+str(action5)" name="value"/></record>
Here is the part of py code:
def default_get(self, cr, uid, fields, context=None):
product_obj = self.pool.get('product.template')
record_ids = context and context.get('active_ids', []) or []
res = {}
for product in product_obj.browse(cr, uid, record_ids, context=context):
if 'default_code' in fields:
#in 'default_code' is a field name of that pop-up window
res.update({'default_code': product.default_code, 'name': product.name, 'uom_id': product.uom_id.id,
'uom_po_id': product.uom_po_id.id, 'type': product.type, 'categ_id': product.categ_id.id })
return res
def action_replace(self, cr, uid, ids, context=None):
txt_value = ''
for record in self.browse(cr,uid,ids,context=context):
txt_value = record.original_id
return {
'type': 'ir.actions.act_window',
'res_model': 'product.template',
'name': _('Replace all in BOM'),
'res_id': ids[0],
'view_type': 'form',
'view_mode': 'form',
'view_id': 1212,
'target': 'new',
'nodestroy': True,
'context': context
}

Whenever a button is clicked, the default behaviour of the system is to save the data first and then to execute the button click function. So in the button click you will find 'ids' of current record. Following is the way where you will get the value of that textbox.
def action_replace(self,cr,uid,ids,context=None):
for record in self.browse(cr,uid,ids,context=context):
txt_value = record.original
<<your further code>>
return True

Related

How to send context to wizard and add reference from Form in Odoo 13

so I Have several fields in my Wizard model that the default value is the same from the form but we can change it. I try to send my form field value using context but it has an error like this
odoo.tools.convert.ParseError: ": "name
'arrival_date' is not defined"
while evaluating. The name of the field already right because when I use context in my line or one2many field It works just fine.
And Second when I create the record its not referencing my form record. Do I need to change the default write method?
<record model="ir.ui.view" id="kre_product_reservation_wizard_form_view">
<field name="name">kre.product_reservation.form</field>
<field name="model">kre.product_reservation</field>
<field name="arch" type="xml">
<form string="Add Attendees">
<group>
<group>
<!-- Add your fields here -->
<field name="reservation_number"/>
<field name="arrivals_date"/>
<field name="departure_date"/>
<field name="stay_period"/>
<field name="qty"/>
<field name="price"/>
<field name="tax"/>
<field name="sub_amount"/>
<field name="tax_amount"/>
<field name="amount"/>
<field name="description"/>
</group>
<notebook>
<page string="Guest List">
<field name="guests"/>
</page>
</notebook>
</group>
</form>
</field>
</record>
<act_window id="insert_reservation_wizard" name="Insert Reservation" context="{'reservation_id' : active_id, 'arrival_date' : arrival_date, 'departure_date' : departure_date}" binding_model="kre.reservation" res_model="kre.product_reservation" view_mode="form" target="new"/>
And this is the binding model Field that I want to send in Context.
<field name="name"/>
<field name="billing_name"/>
<field name="arrival_date"/>
<field name="departure_date"/>
<field name="group"/>
<field name="currency"/>
<field name="sub_total"/>
<field name="tax"/>
<field name="total"/>
Hello Theodorus Agum Gumilang,
On your act_window you can set the model id or any selection or boolean from the default context passing. Like this,
<act_window id="insert_reservation_wizard"
name="Insert Reservation"
binding_model="kre.reservation"
res_model="kre.product_reservation"
view_mode="form"
context="{'default_reservation_id' : active_id, 'reservation_id' : active_id}"
target="new"/>
You can check the other reference on odoo for default value set from act_window. As on your default value set from the form itself on wizard view, you can do with by changing the approach this way,
1) Calling your wizard action from the python.
2) On the python, you can pass the default value on context.
On you form view added the button,
<button name="action_wizard" string="Your String" type="object" class="btn-primary" />
On Python Function,
def action_wizard(self):
return {
'name': _("Your String"),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'Object',
'view_id': self.env.ref('module.ref_id').id,
'target': 'new',
'context': {
'default_name': self.default_name,
'default_billing_name': self.default_billing_name,
'default_arrival_date': self.default_arrival_date,
'default_departure_date': self.default_departure_date,
'default_group': self.default_group,
'default_currency': self.default_currency,
'default_sub_total': self.default_sub_total,
'default_tax': self.default_tax,
'default_total': self.default_total
}}
Thanks

Show from Action Menu the Res_partner Form with partner information corresponding to the current User

In order to show this form view :
<record model="ir.ui.view" id="program_viewform">
<field name="name">My Program</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<form>
<separator string="My Program " />
<field name="projects_ids" nolabel="True"/>
<separator string="submitted Tasks" />
<field name="submission_task_ids" nolabel="True"/>
</form>
</field>
</record>
I created this action :
<record model="ir.actions.act_window" id="myprogram_action">
<field name="name">My Program</field>
<field name="res_model">res.partner</field>
<field name="form_view_id" ref="training_program_management.program_viewform"/>
<field name="domain">[('id','=',user.id.partner_id)]</field>
<field name="view_mode">form</field>
</record>
and this Menu :
<menuitem name="My Program" id="program_menu" sequence="5"
parent="training_program_management.menu" action="training_program_management.myprogram_action"/>
What I need is to show the record of res_partner corresponding to the current User, knowing that res.users contains a Many2one Field "Partner_id".
What do I need to do?
This is tested for odoo 8 but it can probably be adapted for odoo 10 or at least help you :
Change <record model="ir.actions.act_window" id="myprogram_action"> to <record model="ir.actions.server" id="myprogram_action">
Then add (yes, old API is on purpose, it doesn't work with the new API, for odoo 8 that is)
<field name='model_id' ref='base.model_res_partner'/>
<field name="code">
action = self._action_open_user_res_partner(cr, uid)
</field>
Create a model extending res.partner in your module, add (more old API ... also I didn't find a way to use ref())
#api.model
def _action_open_user_res_partner(self, cr, uid):
return {
'view_type': 'form',
'view_mode': 'form',
# Since this is a constant, you can use a global to hold the value for 'view_id'
'view_id': int(self.pool['ir.ui.view'].search(cr, uid,
[('name', '=', 'My Program')])[0]),
'res_model': 'res.partner',
'res_id': int(self.pool['res.users'].browse(cr, uid, [uid])[0].partner_id),
'type': 'ir.actions.act_window',
'context': {}
}
Adapting this to odoo 10 probably involves using the new API instead of the old one. This means self.pool should be self.env or env, and that you don't need cr and uid anymore. You can use user variable instead of uid in the function returning (well actually it could be used for odoo 8 too, but since uid is needed anyway...).
On the other hand, the documentation for odoo 10 about actions strongly suggests you'd still need to use the old API for this, except for model replacing self.
So you should first try something like this for odoo 10 :
<field name='model_id' ref='base.model_res_partner'/>
<field name="code">
action = model._action_open_user_res_partner(cr, uid)
</field>
The function in the model is still the same, since we still use the old API.
If it doesn't work, you should try with the new API (get rid of cr, uid)
The code bellow, worked perfectly for me, Thank you alot for your help:
<record model="ir.actions.server" id="myprogram_action">
<field name="name">My Program</field>
<field name='model_id' ref='base.model_res_partner'/>
<field name="state">code</field>
<field name="code">
action = {
'type': 'ir.actions.act_window',
'name': 'My Program',
'view_mode': 'form',
'view_type': 'form',
'res_model': 'res.partner',
'nodestroy': 'true',
'res_id': int(env['res.users'].browse(env.user.partner_id.id)),
'views': [(False, 'form')],
'view_id': 'ref="training_program_management.program_viewform"',
}
</field>
</record>
Still have a small problem thou, i have two FormViews for res.partner, this line doesn't seem to show the desired View:
'view_id': 'ref="training_program_management.program_viewform"',
It shows me The First FormView That i've inherited.
My training_program_management.program_viewform :
<record model="ir.ui.view" id="program_viewform">
<field name="name">My Program</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<form>
<separator string="My Program " />
<field name="projects_ids" nolabel="True"/>
<separator string="submitted Tasks" />
<field name="submission_task_ids" nolabel="True"/>
</form>
</field>
</record>
What can i do to show this View Instead Of the inherited one ?

Openerp Rederecting to other view on button click

I am trying to execute a function to populate new tree view. I need to execute the function and redirecting to the tree view done by only one button. Please help me with doing it.
My function is
def populate_values(self, cr, uid, ids, context={}):
result = {'value': {}}
today = datetime.datetime.now()
tt=today.date()
emps=self.pool.get('hr.employee').search(cr, uid, [('current_status','=','active')], context=context)
if emps:
#...
#...
#...
return {
'name':_("leave.score.card.tree"),
'view_mode': 'tree',
'view_id': '%(open_leave_score_card_tree)d',
'views': [('tree'),('graph')],
'view_type': 'graph',
'res_id' : '%(open_leave_score_card)d',
'res_model': 'leave.score.card',
'type': 'ir.actions.act_window',
'target': 'new',
}
Form view with the button
<record model="ir.ui.view" id="edit_leave_score_card_form">
<field name="name">leave.score.card.form</field>
<field name="model">leave.score.card</field>
<field name="arch" type="xml">
<form string="Leave Score Card" create="false" edit="false" version="7.0">
<sheet>
<button string="Generate" type="object" name="populate_values" class="oe_highlight"/>
</sheet>
</form>
</field>
</record>
The tree view where I need to get redirected
<record model="ir.ui.view" id="view_leave_score_card_tree">
<field name="name">leave.score.card.tree</field>
<field name="model">leave.score.card</field>
<field name="arch" type="xml">
<tree string="Leave Score Card To the Date" create="false" edit="false" colors="red:available_medical < 0.0; red:available_casual < 0.0">
<field name="employee_id" />
<field name="category_id" />
<field name="taken_medical" />
<field name="taken_casual" />
<field name="taken_annual" />
<field name="taken_spc" />
<field name="available_medical" />
<field name="available_casual" />
<field name="available_annual" />
<field name="available_spc" />
<field name="sec_id" invisible="1" />
</tree>
</field>
</record>
Action windows
<record id="open_leave_score_card" model="ir.actions.act_window">
<field name="name">Leave Score Card Form</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">leave.score.card</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
</record>
<record id="open_leave_score_card_tree" model="ir.actions.act_window">
<field name="name">Leave Score Card Tree</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">leave.score.card</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="view_id" eval="view_leave_score_card_tree"/>
<field name="search_view_id" ref="view_leave_score_card_search"/>
</record>
Please let me know where I did wrong because the button call totally not redirecting
No need to write any function for that. I understand that you want to print score card of the employee while you click on the button.
Update action of score card as follow.
<record id="open_leave_score_card_tree" model="ir.actions.act_window">
<field name="name">Leave Score Card Tree</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">leave.score.card</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="view_id" eval="view_leave_score_card_tree"/>
<field name="search_view_id" ref="view_leave_score_card_search"/>
<field name="context">{
'search_default_employee_id': [active_id],
'default_employee_id': active_id,
'active_test': False,}
</field>
</record>
And then change button code in xml as follow.
<button string="Generate" type="action" name="%(open_leave_score_card_tree)d" class="oe_highlight"/>
Remove function no need it. And if you want to do it with the existing code without changing anything then set domain in dynamic action which you are returning from the function.
In your function you have written wrong view_type, it should be form not graph if you want to return list view then.
def populate_values(self, cr, uid, ids, context={}):
today = datetime.datetime.now()
tt=today.date()
emps=self.pool.get('hr.employee').search(cr, uid, [('current_status','=','active')], context=context)
if emps:
return {
'name':_("leave.score.card.tree"),
'view_mode': 'tree',
'view_id': '%(open_leave_score_card_tree)d',
'views': [('tree'),('graph')],
'view_type': 'form',
'res_id' : '%(open_leave_score_card)d',
'res_model': 'leave.score.card',
'type': 'ir.actions.act_window',
'domain' : [('employee_id','in', ids)],
'target': 'new',
}
return True

Create a dynamic Wizard with links to download pdf files

I'm trying to create a report button in:
view: account_payment.view_payment_order_form
model: payment.order
Accounting -> Payment -> Rec. Payment order -> FORM
My goal is to obtain each line of 'line_ids' and open a Wizard that populates with a download link for each line of 'line_ids'.
For the moment I'm trying to create a dynamic Wizard with no luck. I don't know if it is possible to do this.
Thanks for the answers.
Wizard model:
class my_wizard(osv.TransientModel):
_name = 'my_wizard'
_columns = {
'line_ids': fields.one2many('payment.order', 'Payment order'),
}
Call wizard (in "payment.order" model):
def call_wizard(self, cr, uid, ids, context):
my_wizard_form_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_payment', 'my_wizard_form')[1]
lines = []
for line in self.browse(cr, uid, ids, context).line_ids:
lines.append([0, 0, {'line_id': line.id}])
#To create records dyamically
ctx={'default_line_ids': lines}
return {
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'my_wizard',
'views': [(my_wizard_form_id, 'form')],
'view_id': my_wizard_form_id,
'target': 'new',
'context': ctx,
}
Wizard view:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="my_wizard_form" model="ir.ui.view">
<field name="name">my_wizard.form</field>
<field name="model">my_wizard</field>
<field name="type">form</field>
<field name="arch" type="xml" >
<form>
<field name="line_ids" widget="one2many_list">
<tree editable="bottom">
<field name="id"/>
<!-- define "download" function in "payment.line"
<button name='download' type='object' string='download' />
</tree>
</field>
<field name='' />
</group>
</form>
</field>
</record>
<record id="action_my_wizard_form" model="ir.actions.act_window">
<field name="name"></field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">my_wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>
Button to call wizard (payment_order view):
<button name='call_wizard' type="object" string="WIZARD" />
You should create download method in payment.line model.
def download(self, cr, uid, ids, context):
#To open an URL
'''return {
"type": "ir.actions.act_url",
"url": "LINK TO PDF",
"target": "self",
}
'''
#To generate a report
datas = {
'ids': ids,
'model': 'dossier',
'form': self.read(cr, uid, ids[0], context=context)
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'my_report',
'datas': datas,
'nodestroy': True
}
I hope this will be useful.

Custom Module Add Customers Automatically in Openerp

I have a custom module where i have inherited res.partner.I have a field "doctor"(which is many2one field).When i create a customer i can select a doctor.In img 1 Willam is the customer and he has selected Nitesh as the doctor.I have created doctor_view.xml which will show all the details of the Doctor.Now in img 2 , as we have selected "Nitesh" as 'Doctor' for 'Customer Willam',i should display "Willam" under "Client" in img2. Can anyone help me in this?Thanks in advance
My code
Customer.py
from qrcode import *
from osv import osv
from osv import fields
class res_partner(osv.osv):
_inherit = "res.partner"
_description = "adding fields to res.partner"
_columns = {
'doctor': fields.many2one('crm.lead.doctor','Doctor'),
}
class crm_lead_doctor(osv.osv):
_name = "crm.lead.doctor"
_order = "name"
_columns ={
'name':fields.char('Doctor Name',required=True,size=64,translate=True),
'doctor_id':fields.char('Doctor Id',size=64,readonly=True),
'doctor_mobile': fields.char('Mobile',required=True,size=64),
'doctor_email': fields.char('Email',size=64),
'doctor_hospital': fields.many2one('crm.lead.hospital','Hospital'),
'doctor_street': fields.char('Street', size=128),
'doctor_street2': fields.char('Street2', size=128),
'doctor_zip': fields.char('Zip', change_default=True, size=24),
'doctor_city': fields.char('City', size=128),
'doctor_state_id': fields.many2one("res.country.state", 'State'),
'doctor_country_id': fields.many2one('res.country', 'Country'),
'doctor_brochure': fields.char('Brochuer',size=64),
'doctor_flyer': fields.char('Flyer',size=64),
'doctor_training': fields.char('Training',size=64),
'doctor_starterpacksent': fields.char('Strater pack sent',size=64),
'doctor_no_of_deliveries': fields.char('No of Deliveries/year',size=64),
'doctor_fee': fields.char('Fee',size=64),
'doctor_registration': fields.char('Registration No',size=64),
'doctor_pancard': fields.char('Pan Card No',size=64),
'doctor_fiscalcode': fields.char('Fiscal Code',size=64),
'doctor_iban': fields.char('IBAN',size=64),
'doctor_contractset': fields.char('Contract Set',size=64),
'doctor_contractrecieved': fields.char('Contract Recieved',size=64),
'doctor_clients':fields.many2many('res.partner')
}
def create(self, cr, uid, vals, context={}):
doc_seq = self.pool.get('ir.sequence').get(cr, uid, 'master.doctor')
vals['doctor_id'] = doc_seq
res = super(res_partner.crm_lead_doctor, self).create(cr, uid, vals, context)
return res
Doctor_view.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_doctor_form_extended" model="ir.ui.view">
<field name="name">crm.lead.doctor.form</field>
<field name="model">crm.lead.doctor</field>
<field name="arch" type="xml">
<form string="Doctor Details" version="7.0">
<group>
<field name="name"/>
<!-- <field name="doctor_id"/> -->
<field name="doctor_mobile"/>
<field name="doctor_email"/>
<field name="doctor_hospital"/>
<label for="street" string="Doctor Address"/>
<div>
<field name="doctor_street" placeholder="Street..."/>
<field name="doctor_street2"/>
<div class="address_format">
<field name="doctor_city" placeholder="City" style="width: 40%%"/>
<field name="doctor_state_id" on_change="onchange_state(state_id)" options='{"no_open": True}' placeholder="State" style="width: 24%%"/>
<field name="doctor_zip" placeholder="ZIP" style="width: 34%%"/>
</div>
<field name="doctor_country_id" placeholder="Country" options='{"no_open": True}'/>
</div>
</group>
<notebook>
<page string="Sales">
<group>
<group>
<field name="doctor_brochure"/>
<field name="doctor_flyer"/>
<field name="doctor_training"/>
<field name="doctor_starterpacksent"/>
<field name="doctor_no_of_deliveries"/>
<field name="doctor_fee"/>
</group>
<group>
<field name="doctor_registration"/>
<field name="doctor_pancard"/>
<field name="doctor_fiscalcode"/>
<field name="doctor_iban"/>
<field name="doctor_contractset"/>
<field name="doctor_contractrecieved"/>
</group>
</group>
</page>
<page string="Clients">
<field name="doctor_clients"/>
</page>
</notebook>
</form>
</field>
</record>
<record id="view_doctor_tree_extended" model="ir.ui.view">
<field name="name">crm.lead.doctor.tree</field>
<field name="model">crm.lead.doctor</field>
<field name="arch" type="xml">
<tree string="Doctor Details" version="7.0">
<field name="doctor_id"/>
<field name="name"/>
<field name="doctor_mobile"/>
<field name="doctor_email"/>
<field name="doctor_hospital"/>
</tree>
</field>
</record>
<record id="new_doctor" model="ir.actions.act_window">
<field name="name">Doctors</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">crm.lead.doctor</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_doctor_tree_extended"/>
</record>
<!-- ===========================Menu Settings=========================== -->
<menuitem name ="Doctors - Hospitals" id = "menu_lead" />
<menuitem name="Doctors" id="sub_menu_lead" parent="menu_lead" />
<menuitem name="Doctors" id="create_lead" parent="sub_menu_lead" action="new_doctor"/>
</data>
</openerp>
that's a perfect example for a one2many relationship between doctor-client. if you would realise it that way in openerp, you will have the clients shown in your doctor-view.
many2many would make sense, if your client has more than one doctor.
little hint: 'doctor_clients':fields.one2many('res.partner','doctor')
from qrcode import *
from osv import osv
from osv import fields
class res_partner(osv.osv):
_inherit = "res.partner"
_description = "adding fields to res.partner"
_columns = {
'doctor': fields.many2one('crm.lead.doctor','Doctor'), #the so called relation_field for the one2many relation to crm.lead.doctor
}
class crm_lead_doctor(osv.osv):
_name = "crm.lead.doctor"
_order = "name"
_columns ={
'name':fields.char('Doctor Name',required=True,size=64,translate=True),
'doctor_id':fields.char('Doctor Id',size=64,readonly=True),
'doctor_mobile': fields.char('Mobile',required=True,size=64),
'doctor_email': fields.char('Email',size=64),
'doctor_hospital': fields.many2one('crm.lead.hospital','Hospital'),
'doctor_street': fields.char('Street', size=128),
'doctor_street2': fields.char('Street2', size=128),
'doctor_zip': fields.char('Zip', change_default=True, size=24),
'doctor_city': fields.char('City', size=128),
'doctor_state_id': fields.many2one("res.country.state", 'State'),
'doctor_country_id': fields.many2one('res.country', 'Country'),
'doctor_brochure': fields.char('Brochuer',size=64),
'doctor_flyer': fields.char('Flyer',size=64),
'doctor_training': fields.char('Training',size=64),
'doctor_starterpacksent': fields.char('Strater pack sent',size=64),
'doctor_no_of_deliveries': fields.char('No of Deliveries/year',size=64),
'doctor_fee': fields.char('Fee',size=64),
'doctor_registration': fields.char('Registration No',size=64),
'doctor_pancard': fields.char('Pan Card No',size=64),
'doctor_fiscalcode': fields.char('Fiscal Code',size=64),
'doctor_iban': fields.char('IBAN',size=64),
'doctor_contractset': fields.char('Contract Set',size=64),
'doctor_contractrecieved': fields.char('Contract Recieved',size=64),
'doctor_clients':fields.one2many('res.partner','doctor','Clients') #here we use 'doctor' the new field of res.partner as relation_field to bind the relation
}
def create(self, cr, uid, vals, context={}):
doc_seq = self.pool.get('ir.sequence').get(cr, uid, 'master.doctor')
vals['doctor_id'] = doc_seq
res = super(res_partner.crm_lead_doctor, self).create(cr, uid, vals, context)
the views are just fine
return res
If I understand correctly you want to see the customer under the doctor's clients?
The customer will show under the doctor's clients only once you save the customer. Before you save, the link is not created so it wont show in the doctor's form view.
If you save the customer, and then open the doctor it should show as a client.