I have below model in one of my custom module
_name = "receipt.details" _description = "receipt_details" _columns = { 'date': fields.date('Date', required=True), 'manual_receipt_no': fields.char('Manual Receipt No'), 'billnumber': fields.char('Receipt Number', readonly=True), 'companyid': fields.integer('Comp_ID', readonly=True), 'chq_dd_no': fields.char('Chq/DD No'), 'cheque_date': fields.datetime('Cheque Date'), 'bank_name': fields.char("Bank Name"), 'child_receipt': fields.one2many('child.receipt', 'rel_id', 'Child Details', ondelete='cascade'), 'officer_name': fields.many2one('hr.employee', "Officer Name", required=True, ondelete='restrict'), 'total': fields.function(fnct_total_fee, method=True, string='Total', type='float', store=True), 'note': fields.text('Note'), 'is_deleted': fields.boolean('Is Deleted'), 'ip_address': fields.char('ip Address'), 'type': fields.char('Type'), # 'account_name': fields.selection(_get_BankName_completelst, "Firm Name", required=True), 'account_name': fields.many2one('account.account', "Firm Name"), 'journal': fields.many2one('account.journal', 'Journal', required=True), 'tally_import': fields.binary('Import File(.xml)'), 'is_bill_cancellation': fields.boolean('Is Bill Cancellation'), 'interest': fields.float('Market Fee Interest'), 'manual_license_number': fields.char('Manual License Number'), }
Now i want show for employee login i want show only that employee name but for admin login i want show all the employees name (officer_name)
Below one is my xml view
<record model="ir.ui.view" id="bank_recieptsinsertion_form">
<field name="name">Receipt Form</field>
<field name="model">receipt.details</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="receipt Form" version="7.0">
<sheet>
<head>
<field name="tally_import" on_change= "onchange_tallyimport(tally_import)" invisible="1"/>
</head>
<group col="4">
<field name="date" on_change= "onchange_date(date)"/>
<field name="account_name" on_change="onchange_account_name(account_name)" required="1"
/>
<field name="manual_license_number" readonly="1"/>
<field name="manual_receipt_no" />
<field name="billnumber"/>
<field name="chq_dd_no" />
<field name="cheque_date" />
<field name="bank_name" />
<field name="officer_name" widget="selection" />
<field name="total" />
<field name="interest" attrs="{'readonly': [('interest', '=', '0')]}"/>
<field name="note" />
<field name="is_deleted" invisible="1" />
<field name="type" invisible="1" />
<field name="ip_address" class="ipcaptuaring" invisible="1"/>
<field name="journal" widget="selection"/>
</group>
<group>
<field name="child_receipt" on_change="onchange_total(child_receipt)" nolabel="1"/>
</group>
</sheet>
</form>
</field>
</record>
Maybe its helpful for you
http://learnopenerp.blogspot.com/2017/11/show-records-on-treeview-that-are.html
please check
Thanks