[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
|
||||
|
||||
_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",
|
||||
store={
|
||||
'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
|
||||
from
|
||||
hr_analytic_timesheet hrt
|
||||
left join (account_analytic_line l
|
||||
LEFT JOIN hr_timesheet_sheet_sheet s
|
||||
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)
|
||||
JOIN account_analytic_line l ON l.id = hrt.line_id
|
||||
LEFT JOIN hr_timesheet_sheet_sheet s ON s.id = hrt.sheet_id
|
||||
group by l.date::date, s.id
|
||||
) union (
|
||||
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
|
||||
from
|
||||
hr_attendance a
|
||||
LEFT JOIN (hr_timesheet_sheet_sheet s
|
||||
LEFT JOIN resource_resource r
|
||||
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)
|
||||
LEFT JOIN hr_timesheet_sheet_sheet s
|
||||
ON s.id = a.sheet_id
|
||||
WHERE action in ('sign_in', 'sign_out')
|
||||
group by a.name::date, s.id
|
||||
)) AS foo
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
product_id: product.product_product_consultant
|
||||
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}:
|
||||
date_from: !eval time.strftime('%Y-%m-01')
|
||||
name: Quentin Paolinon
|
||||
name: Quentin Paolino
|
||||
state: new
|
||||
user_id: base.user_demo
|
||||
employee_id: 'hr.employee_qdp'
|
||||
|
@ -65,6 +65,7 @@
|
|||
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"),
|
||||
})
|
||||
assert True, "The validation of the timesheet was unexpectedly accepted despite the 2:30 hours of difference"
|
||||
except:
|
||||
pass
|
||||
-
|
||||
|
@ -87,7 +88,7 @@
|
|||
!record {model: res.company, id: base.main_company}:
|
||||
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}: |
|
||||
uid = ref('base.user_root')
|
||||
|
|
Loading…
Reference in New Issue