需要显示特定的用户详细信息而不在openerp的搜索框中显示值?

时间:2014-01-24 10:33:12

标签: python openerp

我想显示特定的用户详细信息,而不在搜索框中显示该值。这是图像,

enter image description here

和搜索视图XML:

<record id="view_attendance_filter" model="ir.ui.view">
        <field name="name">Attendance</field>
        <field name="model">hr.employee.attendance</field>
        <field name="arch" type="xml">
            <search string="Attendance">
                <field name="hr_employee_id" string="Employee"/>

            </search>
         </field>
     </record>

   <record id="hr_employee_attendance_tree" model="ir.actions.act_window">
        <field name="name">Employee Attendance</field>
        <field name="res_model">hr.employee.attendance</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
         <field name="context">{'search_default_hr_employee_id':1}</field>
        <field name="view_id" ref="hr_employee_attendance_tree_view"/>
        <field name="search_view_id" ref="view_attendance_filter"/>
    </record>

从上面的xml代码我发送search_default_hr_employee_id,所以它在搜索框中显示用户名。但我想要特定的用户列表而不在搜索框中显示用户名。

2 个答案:

答案 0 :(得分:0)

在新模块中粘贴到xml中:

<record id="view_attendance_filter_yourcompany" model="ir.ui.view">
    <field name="name">Attendance</field>
    <field name="inherit_id" ref="parent_module_name.view_attendance_filter"/>
    <field name="model">hr.employee.attendance</field>
    <field name="arch" type="xml">
         <field name="hr_employee_id" position="replace"/>
     </field>
 </record>

不要忘记更新 openerp .py文件。

答案 1 :(得分:0)

试试这个,

<record id="view_attendance_filter" model="ir.ui.view">
    <field name="name">Attendance</field>
    <field name="model">hr.employee.attendance</field>
    <field name="arch" type="xml">
        <search string="Attendance">
            <field name="hr_employee_id" string=" "/>
        </search>
     </field>
 </record>

<record id="hr_employee_attendance_tree" model="ir.actions.act_window">
    <field name="name">Employee Attendance</field>
    <field name="res_model">hr.employee.attendance</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
     <field name="context">{'search_default_hr_employee_id':1}</field>
    <field name="view_id" ref="hr_employee_attendance_tree_view"/>
    <field name="search_view_id" ref="view_attendance_filter"/>
</record>

如果您将字段 string =“Employee”提供给 hr_employee_id ,则会将Employee显示为您的问题。但是给空字符串比它会起作用。如果您删除字符串,则会提前显示员工

希望这会对你有所帮助。