Odoo Help

Welcome!

This community 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.

0

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

By
Drees Far
on 8/18/16, 5:06 AM 255 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"

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.

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

Drees Far
on 8/19/16, 5:05 AM
0
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.

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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