Odoo Help


ODOO9: How to make a popup opening some specific fields of a model

Vale Trood
on 8/18/16, 5:06 AM 888 views

Hello everybody!!

Need your help friend to know how can i create a popup openning some specific fields of a model.

Here is what i have tried but it doesnt work.

  <button name="action_view_hr_payslip_button"  class="oe_stat_button"




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

<field name="name">hr.payslip.button.form</field>

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

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

<form string="Payslip">

<field name="worked_days_line_ids">

<tree string="Worked Days" editable="bottom">

<field name="name"/>

<field name="code"/>

<field name="number_of_days" sum="Total Working Days"/>

<field name="number_of_hours"/>

<field name="contract_id" invisible="True"/>

<field name="sequence" invisible="True"/>

<field name="cnss_ok"/>

<field name="irpp_t_ok"/>

<field name="irpp_r_ok"/>


<form string="Worked Day">

<group col="4">

<field name="name"/>

<field name="code"/>

<field name="sequence"/>

<field name="number_of_days"/>

<field name="number_of_hours"/>

<field name="contract_id"/>







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

<field name="name">Employee Payslips BUTTON</field>

<field name="type">ir.actions.act_window</field>

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

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

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


Thanks a lot in advance.

hey dear friend i want just open a new popup with some fields of a class. Can you help me please

Vale Trood
on 8/19/16, 5:05 AM
Asmita Chavan
On 8/19/16, 5:04 AM

From your question what I can understand is, you want to create a pop up wizard, showing specific fields of already existing record.

This you can't achieve with action type button, you will need to replace your button with object type button.

       <button name="action_view_hr_payslip_button"  class="oe_stat_button"
         icon="fa-money" type="object"/>

 Then inherit the class in which you have added this button. and add new method which will get called on click of this button.

In this method, you will need to search the record which you want to display on wizard.

def action_view_hr_payslip_button(self):
     form_view_id = self.env.ref("your_module_name.action_view_hr_payslip_button").id
     payslip_id = self.env['hr.payslip'].search(your_search_condition, limit=1)
     return {'name': 'Payslip',
             'type': 'ir.actions.act_window',
             'view_type': 'form',
             'view_mode': 'form',
             'view_id': form_view_id,
             'target': 'new',
             'res_id': payslip_id.id

Hope, this satisfies your requirement.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/18/16, 5:06 AM
Seen: 888 times
Last updated: 8/19/16, 5:04 AM