Odoo's qweb groups_id

246 views Asked by At

With Odoo's Qweb, i wanna apply a restriction into actions. I wanna remove some contacts into list with 'is_b2c' is True.

 <record id="action_contacts" model="ir.actions.act_window">
     <field name="name">Contacts</field>
     <field name="type">ir.actions.act_window</field>
     <field name="res_model">res.partner</field>
     <field name="view_type">form</field>
     <field name="view_mode">kanban,tree,form</field>
     <field name="search_view_id" ref="base.view_res_partner_filter"/>
     <field name="help" type="html">
       <p class="oe_view_nocontent_create">
         Click to add a contact in your contacts directory.
       </p><p>
         Odoo helps you easily track all activities related to
         a customer: discussions, history of business opportunities,
         documents, etc.
       </p>
     </field>
 </record>

The restriction must be:

 <record id="contacts.action_contacts" model="ir.actions.act_window">
        <field name="type">ir.actions.act_window</field>
        <field name="view_type">form</field>
        <field name="view_mode">kanban,tree,form</field>
        <field name="domain">
         [
            ('is_b2c','=', False) <!-- Get contacts with 'is_b2c' is False for -->
         ]
        </field>
        <!-- for this group name only -->
        <field name="groups_id" eval="[(6,0,[ref('sales_team.group_sale_salesman')])]"/>
     </record>


Thanks
1

There are 1 answers

0
Younis Mahsud On

Instead of adding a group on the action, create two separate menu items and also create two separate actions and then add groups on these menu items. On one of the actions add the domain to show only limit contacts.