Adapt hr_holidays post wiz to new field

This commit is contained in:
Alexis de Lattre
2017-06-06 17:57:05 +02:00
parent e5221d6a96
commit 94926d188a
10 changed files with 98 additions and 49 deletions

View File

@@ -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

View File

@@ -11,10 +11,9 @@
<field name="holiday_status_id"/>
<field name="allocated_leaves"/>
<field name="leaves_validated_current"/>
<field name="leaves_validated_posted"/>
<field name="leaves_validated_payslip"/>
<field name="leaves_remaining_current"/>
<field name="leaves_remaining_posted"
sum="Total Posted Remaining Leaves"/>
<field name="leaves_remaining_payslip" sum="Total"/>
</tree>
</field>
</record>