Skip to content
Permalink
Browse files

[FIX] hr_payroll: Use jquery API to generate benefit buttons

Use the proper jquery API instead of handcrafting dom elements.

closes #31091
  • Loading branch information...
LucasLefevre authored and tivisse committed Feb 18, 2019
1 parent ac1ec35 commit 2be9d73f648899b42d97ed5615085dfe9317480a
Showing with 7 additions and 3 deletions.
  1. +7 −3 addons/hr_payroll/static/src/js/benefit.js
@@ -20,7 +20,9 @@ odoo.define('hr_payroll.benefit.view_custo', function(require) {
var primary = !secondary ? 'btn-primary' : 'btn-secondary';
var txt = _t("Generate Benefits");
this.$buttons.find('.o_calendar_button_month').after(
$('<button class="btn ' + primary + ' btn-benefit" type="button">'+ txt +'</button>')
$('<button class="btn btn-benefit" type="button">')
.text(txt)
.addClass(primary)
.off('click')
.on('click', function (e) {
e.preventDefault();
@@ -69,7 +71,8 @@ odoo.define('hr_payroll.benefit.view_custo', function(require) {
}
if (is_validated && events.length !== 0) { // Generate Payslip button
this.$buttons.find('.o_calendar_button_month').after(
$('<button class="btn btn-primary btn-benefit" type="button">'+ _t('Generate Payslips') +'</button>')
$('<button class="btn btn-primary btn-benefit" type="button">')
.text(_t('Generate Payslips'))
.off('click')
// action_hr_payslip_by_employees
.on('click', function (e) {
@@ -87,7 +90,8 @@ odoo.define('hr_payroll.benefit.view_custo', function(require) {
}
else if (!is_validated) { // Validate button
this.$buttons.find('.o_calendar_button_month').after(
$('<button class="btn btn-primary btn-benefit" type="button">'+ _t('Validate Benefits') +'</button>')
$('<button class="btn btn-primary btn-benefit" type="button">')
.text(_t('Validate Benefits'))
.off('click')
.on('click', function (e) {
e.preventDefault();

0 comments on commit 2be9d73

Please sign in to comment.
You can’t perform that action at this time.