Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cgscop_timesheet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Le Filament
Confédération Générale des SCOP
cgscop_timesheet
Commits
869c3ec7
Commit
869c3ec7
authored
1 year ago
by
Hervé Silvant - CGScop
Browse files
Options
Downloads
Patches
Plain Diff
Ajout d'un total par activité sur l'impression de la feuille de temps
parent
0c0f7a76
No related branches found
No related tags found
1 merge request
!9
Ajout d'un total par activité sur l'impression de la feuille de temps
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
models/cgscop_timesheet_sheet.py
+51
-0
51 additions, 0 deletions
models/cgscop_timesheet_sheet.py
report/report_hr_timesheet_act.xml
+18
-12
18 additions, 12 deletions
report/report_hr_timesheet_act.xml
with
69 additions
and
12 deletions
models/cgscop_timesheet_sheet.py
+
51
−
0
View file @
869c3ec7
...
...
@@ -123,3 +123,54 @@ class ScopHrTimesheetSheet(models.Model):
return
self
.
env
.
ref
(
"
cgscop_timesheet.cgscop_timesheet_sheet_report
"
).
report_action
(
self
)
# ------------------------------------------------------
# Retourne les lignes de la Fdt avec les totaux par projet
# ------------------------------------------------------
def
_to_duration
(
self
,
infloat
):
return
'
{0:02.0f}:{1:02.0f}
'
.
format
(
*
divmod
(
infloat
*
60
,
60
))
def
_get_timesheet_line_act
(
self
):
for
sheet
in
self
:
lines
=
sheet
.
timesheet_line_ids
.
sorted
(
key
=
lambda
b
:
(
b
.
project_id
.
name
,
b
.
date
))
rows
=
[]
last_project
=
False
tot_project
=
0
for
line
in
lines
:
# On insère un total intermédiaire
if
last_project
!=
line
.
project_id
.
name
and
tot_project
!=
0
:
rows
.
append
({
'
total
'
:
1
,
'
name
'
:
False
,
'
partner
'
:
False
,
'
project
'
:
False
,
'
date
'
:
False
,
'
ur_financial_system
'
:
'
Total
'
+
last_project
+
'
:
'
+
self
.
_to_duration
(
tot_project
),
'
unit_amount
'
:
False
,
})
tot_project
=
0
# On insère la ligne lue
rows
.
append
({
'
total
'
:
0
,
'
name
'
:
line
.
name
,
'
partner
'
:
line
.
partner_id
.
name
,
'
project
'
:
line
.
project_id
.
name
,
'
date
'
:
line
.
date
,
'
ur_financial_system
'
:
line
.
ur_financial_system_id
.
name
,
'
unit_amount
'
:
self
.
_to_duration
(
line
.
unit_amount
),
})
last_project
=
line
.
project_id
.
name
tot_project
=
tot_project
+
line
.
unit_amount
# On insère le dernier total
rows
.
append
({
'
total
'
:
1
,
'
name
'
:
False
,
'
partner
'
:
False
,
'
project
'
:
False
,
'
date
'
:
False
,
'
ur_financial_system
'
:
'
Total
'
+
last_project
+
'
:
'
+
self
.
_to_duration
(
tot_project
),
'
unit_amount
'
:
False
,
})
return
rows
This diff is collapsed.
Click to expand it.
report/report_hr_timesheet_act.xml
+
18
−
12
View file @
869c3ec7
...
...
@@ -51,21 +51,27 @@
</thead>
<tbody
class=
"invoice_tbody"
>
<t
t-foreach=
"o.timesheet_line_
ids.sorted(key=lambda b: (b.project_id.name,b.date)
)"
t-foreach=
"o.
_get_
timesheet_line_
act(
)"
t-as=
"line"
>
<tr>
<td><span
t-field=
"line.project_id"
/></td>
<td><span
t-field=
"line.date"
/></td>
<td><span
t-field=
"line.partner_id"
/></td>
<td><span
t-field=
"line.name"
/></td>
<td><span
t-field=
"line.ur_financial_system_id"
/></td>
<td
class=
"text-right"
><span
t-field=
"line.unit_amount"
t-options=
"{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"
/></td>
<td><span><t
t-esc=
"line['project']"
/></span></td>
<td><span><t
t-esc=
"line['date']"
/></span></td>
<td><span><t
t-esc=
"line['partner']"
/></span></td>
<td><span><t
t-esc=
"line['name']"
/></span></td>
<td><span>
<t
t-if=
"line['total']==1"
>
<strong>
<t
t-esc=
"line['ur_financial_system']"
/>
</strong>
</t>
<t
t-if=
"line['total']==0"
>
<t
t-esc=
"line['ur_financial_system']"
/>
</t>
</span></td>
<td
class=
"text-right"
><span>
<t
t-esc=
"line['unit_amount']"
/>
</span></td>
</tr>
</t>
<tr>
...
...
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