[REF] hr_holidays: rename hr.leave.report type to report_type

Purpose of this commit is to rename type column to something matching the
the real business use of the field. That way it is easier to find and grep
in the code. It also lessens potential conflicts with type build-in python
function. It also lessens conflicts when using the field in JS as type
is a build-in attribute.

Renaming type column is a long-living issue. We choose to do it at the
beginning of the v13 development to catch errors as soon as possible.

This commit is linked to task ID 1896245. It is also a subpart of community
PR #27599.
This commit is contained in:
mreficent
2018-10-19 09:13:15 +00:00
committed by Thibault Delavallée
parent 35a5db92c2
commit 46b2fe4db1
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -13,10 +13,10 @@ class LeaveReport(models.Model):
employee_id = fields.Many2one('hr.employee', string="Employee", readonly=True)
name = fields.Char('Description', readonly=True)
number_of_days = fields.Float('Number of Days', readonly=True)
type = fields.Selection([
leave_type = fields.Selection([
('allocation', 'Allocation Request'),
('request', 'Leave Request')
], string='Request Type', readonly=True)
], string='Request Type', readonly=True, oldname='type')
department_id = fields.Many2one('hr.department', string='Department', readonly=True)
category_id = fields.Many2one('hr.employee.category', string='Employee Tag', readonly=True)
holiday_status_id = fields.Many2one("hr.leave.type", string="Leave Type", readonly=True)
@@ -43,7 +43,7 @@ class LeaveReport(models.Model):
CREATE or REPLACE view hr_leave_report as (
SELECT row_number() over(ORDER BY leaves.employee_id) as id,
leaves.employee_id as employee_id, leaves.name as name,
leaves.number_of_days as number_of_days, leaves.type as type,
leaves.number_of_days as number_of_days, leaves.leave_type as leave_type,
leaves.category_id as category_id, leaves.department_id as department_id,
leaves.holiday_status_id as holiday_status_id, leaves.state as state,
leaves.holiday_type as holiday_type, leaves.date_from as date_from,
@@ -60,7 +60,7 @@ class LeaveReport(models.Model):
null as date_from,
null as date_to,
FALSE as payslip_status,
'allocation' as type
'allocation' as leave_type
from hr_leave_allocation as allocation
union all select
request.employee_id as employee_id,
@@ -74,7 +74,7 @@ class LeaveReport(models.Model):
request.date_from as date_from,
request.date_to as date_to,
request.payslip_status as payslip_status,
'request' as type
'request' as leave_type
from hr_leave as request) leaves
);
""")
@@ -49,7 +49,7 @@
<field name="date_from"/>
<field name="date_to"/>
<field name="state"/>
<field name="type"/>
<field name="leave_type"/>
<field name="name"/>
</tree>
</field>