Add posted counters + update translation

This commit is contained in:
Alexis de Lattre
2015-06-19 18:29:57 +02:00
parent 1108f79664
commit b2a0e44121
4 changed files with 170 additions and 35 deletions

View File

@@ -36,7 +36,9 @@ class HrHolidaysEmployeeCounter(orm.Model):
'holiday_status_id': fields.many2one(
"hr.holidays.status", "Leave Type"),
'current_leaves_taken': fields.float('Current Leaves Taken'),
'current_remaining_leaves': fields.float('Current Remaining Leaves'),
'current_leaves_taken_posted': fields.float('Current Leaves Taken Posted'),
'current_leaves_remaining': fields.float('Current Remaining Leaves'),
'current_leaves_remaining_posted': fields.float('Current Remaining Leaves Posted'),
'total_allocated_leaves': fields.float('Total Allocated Leaves'),
}
@@ -53,7 +55,17 @@ class HrHolidaysEmployeeCounter(orm.Model):
THEN hh.number_of_days * -1
ELSE 0
END) AS current_leaves_taken,
sum(hh.number_of_days) AS current_remaining_leaves,
sum(
CASE WHEN hh.type='remove' AND hh.posted_date IS NOT null
THEN hh.number_of_days * -1
ELSE 0
END) AS current_leaves_taken_posted,
sum(hh.number_of_days) AS current_leaves_remaining,
sum(
CASE WHEN (hh.type='remove' AND hh.posted_date IS NOT null) OR hh.type='add'
THEN hh.number_of_days
ELSE 0
END) as current_leaves_remaining_posted,
sum(
CASE WHEN hh.type = 'add'
THEN hh.number_of_days

View File

@@ -10,9 +10,12 @@
<field name="employee_id"
invisible="not context.get('hr_holidays_employee_counter_tree_main_view')"/>
<field name="holiday_status_id"/>
<field name="current_leaves_taken"/>
<field name="current_remaining_leaves" sum="Total Remaining Leaves"/>
<field name="total_allocated_leaves"/>
<field name="current_leaves_taken"/>
<field name="current_leaves_taken_posted"/>
<field name="current_leaves_remaining" sum="Total Remaining Leaves"/>
<field name="current_leaves_remaining_posted"
sum="Total Remaining and Posted Leaves"/>
</tree>
</field>
</record>