Technical Mailing lijst archieven


Re: Is there any way to customize the view return by clicking "Add an item"?

- 13-02-2019 02:26:22
Hi Meng,

1: Apply Domain: You can always apply a domain on the field in XML as suggested by Kitti in his previous email.
Ex: <field name="employee_ids" nolabel="1" domain="[('xxx', '=', 'yyy')]/>

2: Use Tree View: You can pass the reference of the tree view you wish to open on the field's context in XML.
Ex: <field name="employee_ids" nolabel="1" context="{'tree_view_ref': 'XML_ID_of_TREE_VIEW'}"/>

Let me know if you have any concern in this.

On Wed, Feb 13, 2019 at 9:01 AM Kitti Upariphutthiphong <> wrote:

I think you can try adding domain here?

<field name="employee_ids" nolabel="1" domain="[('xxx', '=', 'yyy')]/>

Can you?

On Tue, Nov 6, 2018 at 1:10 PM meng xiaolin <> wrote:

Here is the scenario: in hr payroll module, when you clicking Generate payslip, a wizard will be opened and you can click “Add an item” to select employees, and the tree of employee will popup, what I am trying to do is :

1, Is it possible to put a domain on many2many field ‘employee_ids’ so that the rows of the tree view will be filtered by this domain?

2, when you clicking “Add an item”, the tree view of ‘hr.employee’ will pop up, is it possible I could change the action window or the tree view of this button without affecting the default tree view and action window of hr.employee module. In other words, there are two action window and tree view of ‘hr.employe’,  one is what you get in hr.employee module’s menus, and the other you get from whenever a many2many filed is used to refer to ‘hr.employee‘。



<?xml version="1.0" encoding="utf-8"?>



        <record id="view_hr_payslip_by_employees" model="ir.ui.view">

            <field name="name">hr_payroll_payslip_employees</field>

            <field name="model">hr.payslip.employees</field>

            <field name="arch" type="xml">

                <form string="Payslips by Employees">


                        <button icon="fa-cogs" string="Generate" name="compute_sheet" type="object" class="oe_highlight"  />



                        <label colspan="4" nolabel="1" string="This wizard will generate payslips for all selected employee(s) based on the dates and credit note specified on Payslips Run." />


                    <group colspan="4" >

                        <separator string="Employees" colspan="4"/>


                        <field name="employee_ids" nolabel="1"/>






        <record id="action_hr_payslip_by_employees" model="ir.actions.act_window">

            <field name="name">Generate Payslips</field>

            <field name="res_model">hr.payslip.employees</field>

            <field name="view_type">form</field>

            <field name="view_mode">tree,form</field>

            <field name="view_id" ref="view_hr_payslip_by_employees"/>

            <field name="target">new</field>




Post to:

Post to:


Sudhir Arya
ERP Harbor Consulting Services
In the Top 5 Position in Odoo Community Forum

The company accepts no liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided unless that information is subsequently confirmed in writing. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.