[FIX] hr_timesheet: improved perfomances on the read of timesheet sheets
bzr revid: qdp-launchpad@openerp.com-20130508085938-a2uyalx1cy2musj0
This commit is contained in:
parent
35811ae629
commit
7351a7312d
|
@ -293,7 +293,7 @@ class hr_timesheet_line(osv.osv):
|
||||||
return ts_line_ids
|
return ts_line_ids
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'sheet_id': fields.function(_sheet, string='Sheet',
|
'sheet_id': fields.function(_sheet, string='Sheet', select="1",
|
||||||
type='many2one', relation='hr_timesheet_sheet.sheet', ondelete="cascade",
|
type='many2one', relation='hr_timesheet_sheet.sheet', ondelete="cascade",
|
||||||
store={
|
store={
|
||||||
'hr_timesheet_sheet.sheet': (_get_hr_timesheet_sheet, ['employee_id', 'date_from', 'date_to'], 10),
|
'hr_timesheet_sheet.sheet': (_get_hr_timesheet_sheet, ['employee_id', 'date_from', 'date_to'], 10),
|
||||||
|
@ -479,12 +479,8 @@ class hr_timesheet_sheet_sheet_day(osv.osv):
|
||||||
0.0 as total_attendance
|
0.0 as total_attendance
|
||||||
from
|
from
|
||||||
hr_analytic_timesheet hrt
|
hr_analytic_timesheet hrt
|
||||||
left join (account_analytic_line l
|
JOIN account_analytic_line l ON l.id = hrt.line_id
|
||||||
LEFT JOIN hr_timesheet_sheet_sheet s
|
LEFT JOIN hr_timesheet_sheet_sheet s ON s.id = hrt.sheet_id
|
||||||
ON (s.date_to >= l.date
|
|
||||||
AND s.date_from <= l.date
|
|
||||||
AND s.user_id = l.user_id))
|
|
||||||
on (l.id = hrt.line_id)
|
|
||||||
group by l.date::date, s.id
|
group by l.date::date, s.id
|
||||||
) union (
|
) union (
|
||||||
select
|
select
|
||||||
|
@ -495,14 +491,8 @@ class hr_timesheet_sheet_sheet_day(osv.osv):
|
||||||
SUM(((EXTRACT(hour FROM a.name) * 60) + EXTRACT(minute FROM a.name)) * (CASE WHEN a.action = 'sign_in' THEN -1 ELSE 1 END)) as total_attendance
|
SUM(((EXTRACT(hour FROM a.name) * 60) + EXTRACT(minute FROM a.name)) * (CASE WHEN a.action = 'sign_in' THEN -1 ELSE 1 END)) as total_attendance
|
||||||
from
|
from
|
||||||
hr_attendance a
|
hr_attendance a
|
||||||
LEFT JOIN (hr_timesheet_sheet_sheet s
|
LEFT JOIN hr_timesheet_sheet_sheet s
|
||||||
LEFT JOIN resource_resource r
|
ON s.id = a.sheet_id
|
||||||
LEFT JOIN hr_employee e
|
|
||||||
ON (e.resource_id = r.id)
|
|
||||||
ON (s.user_id = r.user_id))
|
|
||||||
ON (a.employee_id = e.id
|
|
||||||
AND s.date_to >= date_trunc('day',a.name)
|
|
||||||
AND s.date_from <= a.name)
|
|
||||||
WHERE action in ('sign_in', 'sign_out')
|
WHERE action in ('sign_in', 'sign_out')
|
||||||
group by a.name::date, s.id
|
group by a.name::date, s.id
|
||||||
)) AS foo
|
)) AS foo
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
product_id: product.product_product_consultant
|
product_id: product.product_product_consultant
|
||||||
journal_id: hr_timesheet.analytic_journal
|
journal_id: hr_timesheet.analytic_journal
|
||||||
-
|
-
|
||||||
I create a timesheet for employee "Quentin Paolinon".
|
I create a timesheet for employee "Quentin Paolino".
|
||||||
-
|
-
|
||||||
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
|
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
|
||||||
date_from: !eval time.strftime('%Y-%m-01')
|
date_from: !eval time.strftime('%Y-%m-01')
|
||||||
name: Quentin Paolinon
|
name: Quentin Paolino
|
||||||
state: new
|
state: new
|
||||||
user_id: base.user_demo
|
user_id: base.user_demo
|
||||||
employee_id: 'hr.employee_qdp'
|
employee_id: 'hr.employee_qdp'
|
||||||
|
@ -65,6 +65,7 @@
|
||||||
self.button_confirm(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {"active_ids":
|
self.button_confirm(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {"active_ids":
|
||||||
[ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form")],"active_id": ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form"),
|
[ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form")],"active_id": ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form"),
|
||||||
})
|
})
|
||||||
|
assert True, "The validation of the timesheet was unexpectedly accepted despite the 2:30 hours of difference"
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
-
|
-
|
||||||
|
@ -87,7 +88,7 @@
|
||||||
!record {model: res.company, id: base.main_company}:
|
!record {model: res.company, id: base.main_company}:
|
||||||
timesheet_max_difference: 1.00
|
timesheet_max_difference: 1.00
|
||||||
-
|
-
|
||||||
I tried again to confirm the timesheet after modification.
|
I try again to confirm the timesheet after modification.
|
||||||
-
|
-
|
||||||
!python {model: hr_timesheet_sheet.sheet}: |
|
!python {model: hr_timesheet_sheet.sheet}: |
|
||||||
uid = ref('base.user_root')
|
uid = ref('base.user_root')
|
||||||
|
|
Loading…
Reference in New Issue