Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
C
cgscop_timesheet
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Hervé Silvant - CGScop
cgscop_timesheet
Validations
9eb4895b
Valider
9eb4895b
rédigé
Il y a 2 ans
par
Benjamin - Le Filament
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
[update] theoric timesheet hours
parent
738fe395
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
models/ur_month_timesheet.py
+33
-25
33 ajouts, 25 suppressions
models/ur_month_timesheet.py
static/src/xml/month_timesheet.xml
+28
-26
28 ajouts, 26 suppressions
static/src/xml/month_timesheet.xml
avec
61 ajouts
et
51 suppressions
models/ur_month_timesheet.py
+
33
−
25
Voir le fichier @
9eb4895b
# © 2019 Le Filament (<http://www.le-filament.com>)
# © 2019 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from
datetime
import
date
from
dateutil.relativedelta
import
relativedelta
from
odoo
import
api
,
fields
,
models
from
odoo
import
api
,
fields
,
models
...
@@ -30,7 +34,7 @@ MONTHS = [
...
@@ -30,7 +34,7 @@ MONTHS = [
class
ScopMonthTimesheet
(
models
.
Model
):
class
ScopMonthTimesheet
(
models
.
Model
):
_name
=
"
ur.month.timesheet
"
_name
=
"
ur.month.timesheet
"
_description
=
"
Heures theoriques mensuelles
"
_description
=
"
Heures theoriques mensuelles
"
_order
=
"
year, month
"
_order
=
"
date_timesheet
"
def
_default_ur
(
self
):
def
_default_ur
(
self
):
return
self
.
env
[
"
res.company
"
].
_ur_default_get
()
return
self
.
env
[
"
res.company
"
].
_ur_default_get
()
...
@@ -39,6 +43,11 @@ class ScopMonthTimesheet(models.Model):
...
@@ -39,6 +43,11 @@ class ScopMonthTimesheet(models.Model):
selection
=
get_years
(),
string
=
"
Année
"
,
default
=
fields
.
Date
.
today
().
year
selection
=
get_years
(),
string
=
"
Année
"
,
default
=
fields
.
Date
.
today
().
year
)
)
month
=
fields
.
Selection
(
selection
=
MONTHS
,
string
=
"
Mois
"
)
month
=
fields
.
Selection
(
selection
=
MONTHS
,
string
=
"
Mois
"
)
date_timesheet
=
fields
.
Date
(
string
=
"
Mois format date
"
,
compute
=
"
_compute_date_timesheet
"
,
store
=
True
,
)
company_id
=
fields
.
Many2one
(
company_id
=
fields
.
Many2one
(
comodel_name
=
"
res.company
"
,
comodel_name
=
"
res.company
"
,
string
=
"
Société
"
,
string
=
"
Société
"
,
...
@@ -61,34 +70,33 @@ class ScopMonthTimesheet(models.Model):
...
@@ -61,34 +70,33 @@ class ScopMonthTimesheet(models.Model):
)
)
]
]
@api.depends
(
"
year
"
,
"
month
"
)
def
_compute_date_timesheet
(
self
):
for
month
in
self
:
date_timesheet
=
date
(
int
(
month
.
year
),
int
(
month
.
month
),
1
)
month
.
date_timesheet
=
date_timesheet
@api.model
@api.model
def
get_month_values
(
self
):
def
get_month_values
(
self
):
month_values
=
self
.
search
(
today
=
date
.
today
()
first_date
=
today
.
replace
(
day
=
1
)
-
relativedelta
(
months
=
6
)
last_date
=
today
.
replace
(
day
=
1
)
+
relativedelta
(
months
=
6
)
values
=
self
.
search
(
[
[
"
&
"
,
(
"
date_timesheet
"
,
"
>=
"
,
first_date
),
"
|
"
,
(
"
date_timesheet
"
,
"
<=
"
,
last_date
),
"
&
"
,
(
"
ur_id
"
,
"
=
"
,
self
.
env
.
company
.
ur_id
.
id
),
(
"
year
"
,
"
<
"
,
fields
.
Date
.
today
().
year
),
]
(
"
month
"
,
"
>
"
,
fields
.
Date
.
today
().
month
),
)
"
&
"
,
(
"
year
"
,
"
<
"
,
fields
.
Date
.
today
().
year
+
1
),
(
"
month
"
,
"
<=
"
,
fields
.
Date
.
today
().
month
+
1
),
(
"
ur_id
"
,
"
=
"
,
self
.
env
.
user
.
ur_id
.
id
),
],
limit
=
12
,
order
=
"
year desc, month desc
"
,
).
sorted
(
reverse
=
False
)
return
{
return
{
"
month
"
:
month_values
.
mapped
(
"
month_values
"
:
values
.
mapped
(
lambda
x
:
{
lambda
m
:
{
"
year
"
:
x
.
year
,
"
year
"
:
m
.
year
,
"
num_month
"
:
x
.
month
,
"
month
"
:
self
.
_fields
[
"
month
"
].
selection
[
int
(
m
.
month
)
-
1
][
1
],
"
month
"
:
self
.
_fields
[
"
month
"
].
selection
[
int
(
x
.
month
)
-
1
][
1
],
"
working_time
"
:
m
.
working_time
,
"
date_timesheet
"
:
m
.
date_timesheet
,
}
}
),
),
"
values
"
:
month_values
.
mapped
(
"
working_time
"
),
"
today
"
:
today
.
replace
(
day
=
1
),
"
today
"
:
{
"
year
"
:
fields
.
Date
.
today
().
year
,
"
month
"
:
fields
.
Date
.
today
().
month
,
},
}
}
Ce diff est replié.
Cliquez pour l'agrandir.
static/src/xml/month_timesheet.xml
+
28
−
26
Voir le fichier @
9eb4895b
...
@@ -3,32 +3,34 @@
...
@@ -3,32 +3,34 @@
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<templates
xml:space=
"preserve"
>
<templates
xml:space=
"preserve"
>
<t
t-name=
"ScopMonthTimesheet"
>
<t
t-name=
"ScopMonthTimesheet"
>
<t
t-if=
"widget.values.month_values"
>
<table
class=
"table"
>
<table
class=
"table"
>
<thead>
<thead>
<tr>
<tr>
<t
t-foreach=
"widget.values.month"
t-as=
"m"
>
<t
h
t-foreach=
"widget.values.month
_values
"
t-as=
"m"
>
<t
<div
t-if=
"m.num_month == widget.values.today.month and m.year == widget.values.today.year
"
t-att-class=
"m.date_timesheet == widget.values.today ? 'text-success' : ''
"
>
>
<th
class=
"text-success"
>
<t
t-esc=
"m.month"
/>
<t
t-esc=
"m.year"
/>
<t
t-esc=
"m.month"
/>
<t
t-esc=
"m.year"
/>
</div>
</th>
</th>
</t>
<t
t-else=
""
>
<th>
<t
t-esc=
"m.month"
/>
<t
t-esc=
"m.year"
/>
</th>
</t>
</t>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
<tr>
<tr>
<t
t-foreach=
"widget.values.values"
t-as=
"v"
>
<td
t-foreach=
"widget.values.month_values"
t-as=
"m"
>
<td><t
t-esc=
"v"
/>
h
</td>
<div
</t>
t-att-class=
"m.date_timesheet == widget.values.today ? 'text-right text-success' : 'text-right'"
>
<t
t-esc=
"m.working_time"
/>
h
</div>
</td>
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
</t>
</t>
<t
t-else=
""
>
<p>
Aucun temps de travail théorique n'a été configuré.
</p>
</t>
</t>
</templates>
</templates>
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter