Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
5401 Vistas

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"

icon="fa-money"

type="action">

</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"/>

</tree>

<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"/>

</group>

</form>

</field>

</form>

</field>

</record>

<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>

</record>

Thanks a lot in advance.

Avatar
Descartar
Autor

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

Mejor respuesta

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.

@api.multi     
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.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
sept 23
10472
1
feb 22
7781
1
may 21
9086
2
jul 19
3386
0
nov 18
3298