Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
- <record id="view_hr_payslip_form" model="ir.ui.view">
- <field name="name">hr.payslip.form</field>
- <field name="model">hr.payslip</field>
- <field name="arch" type="xml">
- <form string="Payslip">
- <button string="Confirm" name="hr_verify_sheet" states="draft" class="oe_highlight"/>
- <button string="Refund" name="refund_sheet" states="confirm,done" type='object' />
- <button string="Set to Draft" name="draft" states="cancel"/>
- <button string="Compute Sheet" name="compute_sheet" type="object" states="draft" class="oe_highlight"/>
- <button string="Cancel Payslip" name="cancel_sheet" states="draft,hr_check,confirm,verify"/>
- <field name="state" widget="statusbar" statusbar_visible="draft,confirm"/>
- <div class="oe_right oe_button_box">
- <button name="%(act_payslip_lines)d"
- <field name="payslip_count" widget="statinfo" string="Payslip" help="Payslip Computation Details"/>
- <div class="oe_title">
- <label for="employee_id" class="oe_edit_only"/>
- <h1><field name="employee_id" on_change="onchange_employee_id(date_from, date_to, employee_id, contract_id)"/></h1>
The code above is a part of hr.payroll, which is responsible in the on_change function in payslip, whenever the employee_id is changed, other fields will be filled up.
Now, I created a function that i wanted to be insert/add here in this part, <h1><field name="employee_id" on_change="onchange_employee_id(date_from, date_to, employee_id, contract_id)"/></h1>.
so that everytime the employee_id is changed, it will not only fill up the fields
Paolo, you cannot apply 2 on_change-s on the same field in the same view. So, you need to choose one. It is best that you check the original on_change and make sure that you are not "shuting-off" logics that are necessary for further processing of the Payroll.
Once you confirm on the on_change that you are going to use, you can inherit the view (view_hr_payslip_form), then redefine the field with the new on_change.
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 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 9/8/14, 3:57 AM|
|Seen: 872 times|
|Last updated: 3/16/15, 8:10 AM|