Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
8e52c36a
Commit
8e52c36a
authored
3 years ago
by
Prakash Prajapati
Browse files
Options
Downloads
Patches
Plain Diff
[ADD] hr_timesheet_attendance: add test for timesheet/attendance report
task-2727561 Part-of: odoo/odoo#86914
parent
c56b1e61
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addons/hr_timesheet_attendance/tests/__init__.py
+4
-0
4 additions, 0 deletions
addons/hr_timesheet_attendance/tests/__init__.py
addons/hr_timesheet_attendance/tests/test_timesheet_attendance.py
+35
-0
35 additions, 0 deletions
...r_timesheet_attendance/tests/test_timesheet_attendance.py
with
39 additions
and
0 deletions
addons/hr_timesheet_attendance/tests/__init__.py
0 → 100644
+
4
−
0
View file @
8e52c36a
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from
.
import
test_timesheet_attendance
This diff is collapsed.
Click to expand it.
addons/hr_timesheet_attendance/tests/test_timesheet_attendance.py
0 → 100644
+
35
−
0
View file @
8e52c36a
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from
datetime
import
datetime
from
odoo.tests
import
tagged
from
odoo.addons.hr_timesheet.tests.test_timesheet
import
TestCommonTimesheet
@tagged
(
'
post_install
'
,
'
-at_install
'
)
class
TestTimesheetAttendance
(
TestCommonTimesheet
):
@classmethod
def
setUpClass
(
cls
):
super
().
setUpClass
()
cls
.
env
[
'
hr.attendance
'
].
create
({
'
employee_id
'
:
cls
.
empl_employee
.
id
,
'
check_in
'
:
datetime
(
2022
,
2
,
9
,
8
,
0
),
# Wednesday
'
check_out
'
:
datetime
(
2022
,
2
,
9
,
16
,
0
),
})
def
test_timesheet_attendance_report
(
self
):
self
.
env
[
'
account.analytic.line
'
].
with_user
(
self
.
user_employee
).
create
({
'
name
'
:
'
Test timesheet 1
'
,
'
project_id
'
:
self
.
project_customer
.
id
,
'
unit_amount
'
:
6.0
,
'
date
'
:
datetime
(
2022
,
2
,
9
),
})
report_data
=
self
.
env
[
'
hr.timesheet.attendance.report
'
].
_read_group
(
[(
'
user_id
'
,
'
=
'
,
self
.
user_employee
.
id
),
(
'
date
'
,
'
>=
'
,
datetime
(
2022
,
2
,
9
,
8
,
0
)),
(
'
date
'
,
'
<=
'
,
datetime
(
2022
,
2
,
9
,
16
,
0
))],
[
'
total_timesheet
'
,
'
total_attendance
'
,
'
total_difference
'
],
[
'
user_id
'
],
)[
0
]
self
.
assertEqual
(
report_data
[
'
total_timesheet
'
],
6.0
,
"
Total timesheet in report should be 4.0
"
)
self
.
assertEqual
(
report_data
[
'
total_attendance
'
],
8.0
,
"
Total attendance in report should be 8.0
"
)
self
.
assertEqual
(
report_data
[
'
total_attendance
'
]
-
report_data
[
'
total_timesheet
'
],
2
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment