Skip to content

Commit

Permalink
[FIX] hr_payroll: Use jquery API to generate benefit buttons
Browse files Browse the repository at this point in the history
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 2be9d73
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions addons/hr_payroll/static/src/js/benefit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand All @@ -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();
Expand Down

0 comments on commit 2be9d73

Please sign in to comment.