diff --git a/hr_holidays_usability/__manifest__.py b/hr_holidays_usability/__manifest__.py
index e53d520..529de2b 100644
--- a/hr_holidays_usability/__manifest__.py
+++ b/hr_holidays_usability/__manifest__.py
@@ -21,7 +21,7 @@
'security/holiday_security.xml',
'security/ir.model.access.csv',
'wizard/hr_holidays_mass_allocation_view.xml',
- 'wizard/hr_holidays_post_view.xml',
+ 'wizard/hr_holidays_to_payslip_view.xml',
],
'installable': True,
}
diff --git a/hr_holidays_usability/base_config_settings_view.xml b/hr_holidays_usability/base_config_settings_view.xml
new file mode 100644
index 0000000..86100f8
--- /dev/null
+++ b/hr_holidays_usability/base_config_settings_view.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+ hr_holidays_usability.base.config.settings.form
+ base.config.settings
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hr_holidays_usability/hr_holidays.py b/hr_holidays_usability/hr_holidays.py
index 21d983f..971b501 100644
--- a/hr_holidays_usability/hr_holidays.py
+++ b/hr_holidays_usability/hr_holidays.py
@@ -163,6 +163,21 @@ class HrHolidays(models.Model):
holi.current_leaves_taken = current_leaves_taken
holi.current_remaining_leaves = current_remaining_leaves
+ @api.depends('payslip_date')
+ def _compute_payslip_status(self):
+ for holi in self:
+ if holi.payslip_date:
+ holi.payslip_status = True
+ else:
+ holi.payslip_status = False
+
+ def _set_payslip_status(self):
+ for holi in self:
+ if holi.payslip_status:
+ holi.payslip_date = fields.Date.context_today(self)
+ else:
+ holi.payslip_date = False
+
vacation_date_from = fields.Date(
string='First Day of Vacation', track_visibility='onchange',
readonly=True, states={
@@ -209,8 +224,17 @@ class HrHolidays(models.Model):
limit = fields.Boolean( # pose des pbs de droits
related='holiday_status_id.limit', string='Allow to Override Limit',
readonly=True)
- posted_date = fields.Date(
- string='Posted Date', track_visibility='onchange')
+ payslip_date = fields.Date(
+ string='Transfer to Payslip Date', track_visibility='onchange',
+ readonly=True)
+ # even with the new boolean field "payslip_status", I want to keep
+ # the "posted_date" (renamed payslip_date) field, because I want structured
+ # info. The main argument is that, if I don't write down the info at the end
+ # of the wizard "Post Leave Requests", I want to easily
+ # re-display the info
+ payslip_status = fields.Boolean(
+ readonly=True, compute='_compute_payslip_status',
+ inverse='_set_payslip_status', store=True, track_visibility='onchange')
number_of_days_temp = fields.Float(string="Number of days")
# The 'name' field is displayed publicly in the calendar
# So the label should not be 'Description' but 'Public Title'
diff --git a/hr_holidays_usability/hr_holidays_view.xml b/hr_holidays_usability/hr_holidays_view.xml
index 792e2a9..34f0685 100644
--- a/hr_holidays_usability/hr_holidays_view.xml
+++ b/hr_holidays_usability/hr_holidays_view.xml
@@ -59,8 +59,8 @@ hr_holidays.edit_holiday_new is used for both leaves and allocation -->
-
-
+
+
@@ -85,10 +85,10 @@ hr_holidays.edit_holiday_new is used for both leaves and allocation -->
-
-
+
+
@@ -122,8 +122,11 @@ hr_holidays.edit_holiday_new is used for both leaves and allocation -->
hr.holidays
-
-
+
+
+
+
+
diff --git a/hr_holidays_usability/report/hr_holidays_employee_counter.py b/hr_holidays_usability/report/hr_holidays_employee_counter.py
index 9023c4a..679de3b 100644
--- a/hr_holidays_usability/report/hr_holidays_employee_counter.py
+++ b/hr_holidays_usability/report/hr_holidays_employee_counter.py
@@ -17,9 +17,9 @@ class HrHolidaysEmployeeCounter(models.Model):
holiday_status_id = fields.Many2one(
"hr.holidays.status", string="Leave Type")
leaves_validated_current = fields.Float(string='Current Leaves Validated')
- leaves_validated_posted = fields.Float(string='Leaves Posted')
+ leaves_validated_payslip = fields.Float(string='Leaves in Payslip')
leaves_remaining_current = fields.Float(string='Current Remaining Leaves')
- leaves_remaining_posted = fields.Float(string='Posted Remaining Leaves')
+ leaves_remaining_payslip = fields.Float(string='Remaining Leaves in Payslip')
allocated_leaves = fields.Float(string='Allocated Leaves')
@api.model_cr
@@ -38,18 +38,18 @@ class HrHolidaysEmployeeCounter(models.Model):
END) AS leaves_validated_current,
sum(
CASE WHEN hh.type='remove'
- AND hh.posted_date IS NOT null
+ AND hh.payslip_date IS NOT null
THEN hh.number_of_days * -1
ELSE 0
- END) AS leaves_validated_posted,
+ END) AS leaves_validated_payslip,
sum(hh.number_of_days) AS leaves_remaining_current,
sum(
CASE WHEN (
- hh.type='remove' AND hh.posted_date IS NOT null)
+ hh.type='remove' AND hh.payslip_date IS NOT null)
OR hh.type='add'
THEN hh.number_of_days
ELSE 0
- END) as leaves_remaining_posted,
+ END) as leaves_remaining_payslip,
sum(
CASE WHEN hh.type = 'add'
THEN hh.number_of_days
diff --git a/hr_holidays_usability/report/hr_holidays_employee_counter_view.xml b/hr_holidays_usability/report/hr_holidays_employee_counter_view.xml
index 9118fba..95b1e9d 100644
--- a/hr_holidays_usability/report/hr_holidays_employee_counter_view.xml
+++ b/hr_holidays_usability/report/hr_holidays_employee_counter_view.xml
@@ -11,10 +11,9 @@
-
+
-
+
diff --git a/hr_holidays_usability/security/holiday_security.xml b/hr_holidays_usability/security/holiday_security.xml
index 024e470..18ca566 100644
--- a/hr_holidays_usability/security/holiday_security.xml
+++ b/hr_holidays_usability/security/holiday_security.xml
@@ -4,7 +4,7 @@
diff --git a/hr_holidays_usability/wizard/__init__.py b/hr_holidays_usability/wizard/__init__.py
index 07d448e..c872065 100644
--- a/hr_holidays_usability/wizard/__init__.py
+++ b/hr_holidays_usability/wizard/__init__.py
@@ -1,3 +1,4 @@
-# -*- encoding: utf-8 -*-
+# -*- coding: utf-8 -*-
+
from . import hr_holidays_mass_allocation
-from . import hr_holidays_post
+from . import hr_holidays_to_payslip
diff --git a/hr_holidays_usability/wizard/hr_holidays_post.py b/hr_holidays_usability/wizard/hr_holidays_to_payslip.py
similarity index 69%
rename from hr_holidays_usability/wizard/hr_holidays_post.py
rename to hr_holidays_usability/wizard/hr_holidays_to_payslip.py
index 886c3b5..1b7ef77 100644
--- a/hr_holidays_usability/wizard/hr_holidays_post.py
+++ b/hr_holidays_usability/wizard/hr_holidays_to_payslip.py
@@ -7,9 +7,9 @@ from odoo import models, fields, api, _
from odoo.exceptions import UserError
-class HrHolidaysPost(models.TransientModel):
- _name = 'hr.holidays.post'
- _description = 'Wizard for post holidays'
+class HrHolidaysToPayslip(models.TransientModel):
+ _name = 'hr.holidays.to.payslip'
+ _description = 'Wizard for transfer holidays to payslip'
before_date = fields.Date(
string='Select Leave Requests That Ended Before', required=True,
@@ -17,13 +17,13 @@ class HrHolidaysPost(models.TransientModel):
help="The wizard will select the validated holidays "
"that ended before that date (including holidays that "
"ended on that date).")
- holidays_to_post_ids = fields.Many2many(
- 'hr.holidays', string='Leave Requests to Post',
+ holidays_to_payslip_ids = fields.Many2many(
+ 'hr.holidays', string='Leave Requests to Transfer to Payslip',
domain=[
('type', '=', 'remove'),
('holiday_type', '=', 'employee'),
('state', '=', 'validate'),
- ('posted_date', '=', False),
+ ('payslip_date', '=', False),
])
state = fields.Selection([
('draft', 'Draft'),
@@ -37,35 +37,35 @@ class HrHolidaysPost(models.TransientModel):
('type', '=', 'remove'),
('holiday_type', '=', 'employee'),
('state', '=', 'validate'),
- ('posted_date', '=', False),
+ ('payslip_date', '=', False),
('vacation_date_to', '<=', self.before_date),
('company_id', '=', self.env.user.company_id.id),
])
self.write({
'state': 'done',
- 'holidays_to_post_ids': [(6, 0, hols.ids)],
+ 'holidays_to_payslip_ids': [(6, 0, hols.ids)],
})
action = self.env['ir.actions.act_window'].for_xml_id(
- 'hr_holidays_usability', 'hr_holidays_post_action')
+ 'hr_holidays_usability', 'hr_holidays_to_payslip_action')
action['res_id'] = self.id
return action
@api.multi
def run(self):
self.ensure_one()
- # I have to make a copy of self.holidays_to_post_ids in a variable
+ # I have to make a copy of self.holidays_to_payslip_ids in a variable
# because, after the write, it doesn't have a value any more !!!
- holidays_to_post = self.holidays_to_post_ids
+ holidays_to_payslip = self.holidays_to_payslip_ids
today = fields.Date.context_today(self)
- if not self.holidays_to_post_ids:
- raise UserError(_('No leave request to post.'))
- self.holidays_to_post_ids.write({'posted_date': today})
+ if not self.holidays_to_payslip_ids:
+ raise UserError(_('No leave request to transfer to payslip.'))
+ self.holidays_to_payslip_ids.write({'payslip_date': today})
view_id = self.env.ref('hr_holidays_usability.hr_holiday_pivot').id
action = {
'name': _('Leave Requests'),
'res_model': 'hr.holidays',
'type': 'ir.actions.act_window',
- 'domain': [('id', 'in', holidays_to_post.ids)],
+ 'domain': [('id', 'in', holidays_to_payslip.ids)],
'view_mode': 'pivot',
'view_id': view_id,
}
diff --git a/hr_holidays_usability/wizard/hr_holidays_post_view.xml b/hr_holidays_usability/wizard/hr_holidays_to_payslip_view.xml
similarity index 59%
rename from hr_holidays_usability/wizard/hr_holidays_post_view.xml
rename to hr_holidays_usability/wizard/hr_holidays_to_payslip_view.xml
index 27a5b09..7291c97 100644
--- a/hr_holidays_usability/wizard/hr_holidays_post_view.xml
+++ b/hr_holidays_usability/wizard/hr_holidays_to_payslip_view.xml
@@ -7,22 +7,22 @@
-
- hr_holidays_post_form
- hr.holidays.post
+
+ hr_holidays_to_payslip_form
+ hr.holidays.to.payslip
-
-
- Post Leave Requests
- hr.holidays.post
+
+ Transfer to Payslip
+ hr.holidays.to.payslip
form
new
-