Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
L
lefilament_link_sale_project
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
Le Filament
lefilament_link_sale_project
Validations
6147f06b
Valider
6147f06b
rédigé
Il y a 3 ans
par
root
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
[FIX] incorrect parameters
parent
cdf4e527
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!1
14.0 sale overview
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
models/sale_order.py
+11
-11
11 ajouts, 11 suppressions
models/sale_order.py
avec
11 ajouts
et
11 suppressions
models/sale_order.py
+
11
−
11
Voir le fichier @
6147f06b
...
...
@@ -26,7 +26,7 @@ class SaleOrder(models.Model):
@api.onchange
(
"
partner_id
"
,
"
order_line
"
)
def
_project_name_to_create
(
self
):
so_line_new_project_with_tasks
=
self
.
mapped
(
'
order_line
'
).
filtered
(
lambda
sol
:
sol
.
is_service
and
sol
.
product_id
.
service_tracking
==
'
task_n
ew
_project
'
)
lambda
sol
:
sol
.
is_service
and
sol
.
product_id
.
service_tracking
==
'
task_
i
n_project
'
)
if
not
so_line_new_project_with_tasks
:
self
.
project_tracking
=
False
elif
so_line_new_project_with_tasks
and
self
.
partner_id
:
...
...
@@ -45,7 +45,7 @@ class SaleOrder(models.Model):
self
.
project_id_linked
=
None
if
not
self
.
project_name_to_create
:
so_line_new_project_with_tasks
=
self
.
mapped
(
'
order_line
'
).
filtered
(
lambda
sol
:
sol
.
is_service
and
sol
.
product_id
.
service_tracking
==
'
task_n
ew
_project
'
)
lambda
sol
:
sol
.
is_service
and
sol
.
product_id
.
service_tracking
==
'
task_
i
n_project
'
)
if
so_line_new_project_with_tasks
and
self
.
partner_id
:
self
.
project_name_to_create
=
self
.
partner_id
.
name
+
str
(
'
-
'
)
...
...
@@ -53,7 +53,7 @@ class SaleOrder(models.Model):
# on différencie so_line_new_project (dans _timesheet_service_generation) de so_line_new_project_with_tasks
# car on laisse le fonctionnement natif pour les articles où on crée le projet sans les tâches
so_line_new_project_with_tasks
=
self
.
mapped
(
'
order_line
'
).
filtered
(
lambda
sol
:
sol
.
is_service
and
sol
.
product_id
.
service_tracking
==
'
task_n
ew
_project
'
)
lambda
sol
:
sol
.
is_service
and
sol
.
product_id
.
service_tracking
==
'
task_
i
n_project
'
)
if
(
so_line_new_project_with_tasks
and
not
self
.
project_id_linked
)
and
(
so_line_new_project_with_tasks
and
not
self
.
project_name_to_create
):
raise
ValidationError
(
...
...
@@ -73,14 +73,14 @@ class SaleOrder(models.Model):
class
SaleOrderLine
(
models
.
Model
):
_inherit
=
"
sale.order.line
"
def
_convert_qty_company_hours
(
self
):
def
_convert_qty_company_hours
(
self
,
dest_company
):
"""
Reprise de la fonction native pour changer le mode de calcul des heures planifiées dans timesheet
"""
company_time_uom_id
=
self
.
env
.
user
.
company
_id
.
project_time_mode_id
company_time_uom_id
=
dest_
company
.
project_time_mode_id
taux_horaire
=
self
.
order_id
.
taux_horaire
if
self
.
product_uom
.
id
!=
company_time_uom_id
.
id
\
and
self
.
product_uom
.
category_id
.
id
==
company_time_uom_id
.
category_id
.
id
:
planned_hours
=
super
(
SaleOrderLine
,
self
).
_convert_qty_company_hours
planned_hours
=
super
(
SaleOrderLine
,
self
).
_convert_qty_company_hours
(
dest_company
)
else
:
planned_hours
=
(
self
.
product_uom_qty
*
self
.
price_unit
)
/
taux_horaire
return
planned_hours
...
...
@@ -115,7 +115,7 @@ class SaleOrderLine(models.Model):
so_line_task_global_project
=
self
.
filtered
(
lambda
sol
:
sol
.
is_service
and
sol
.
product_id
.
service_tracking
==
'
task_global_project
'
)
so_line_new_project
=
self
.
filtered
(
lambda
sol
:
sol
.
is_service
and
sol
.
product_id
.
service_tracking
in
[
'
project_only
'
,
'
task_n
ew
_project
'
])
lambda
sol
:
sol
.
is_service
and
sol
.
product_id
.
service_tracking
in
[
'
project_only
'
,
'
task_
i
n_project
'
])
# search so lines from SO of current so lines having their project generated, in order to check if the
# current one can create its own project, or reuse the one of its order.
...
...
@@ -123,11 +123,11 @@ class SaleOrderLine(models.Model):
if
so_line_new_project
:
order_ids
=
self
.
mapped
(
'
order_id
'
).
ids
so_lines_with_project
=
self
.
search
([(
'
order_id
'
,
'
in
'
,
order_ids
),
(
'
project_id
'
,
'
!=
'
,
False
),
(
'
product_id.service_tracking
'
,
'
in
'
,
[
'
project_only
'
,
'
task_n
ew
_project
'
]),
'
product_id.service_tracking
'
,
'
in
'
,
[
'
project_only
'
,
'
task_
i
n_project
'
]),
(
'
product_id.project_template_id
'
,
'
=
'
,
False
)])
map_so_project
=
{
sol
.
order_id
.
id
:
sol
.
project_id
for
sol
in
so_lines_with_project
}
so_lines_with_project_templates
=
self
.
search
([(
'
order_id
'
,
'
in
'
,
order_ids
),
(
'
project_id
'
,
'
!=
'
,
False
),
(
'
product_id.service_tracking
'
,
'
in
'
,
[
'
project_only
'
,
'
task_n
ew
_project
'
]),
'
product_id.service_tracking
'
,
'
in
'
,
[
'
project_only
'
,
'
task_
i
n_project
'
]),
(
'
product_id.project_template_id
'
,
'
!=
'
,
False
)])
map_so_project_templates
=
{(
sol
.
order_id
.
id
,
sol
.
product_id
.
project_template_id
.
id
):
sol
.
project_id
for
sol
in
so_lines_with_project_templates
}
...
...
@@ -153,7 +153,7 @@ class SaleOrderLine(models.Model):
if
map_sol_project
.
get
(
so_line
.
id
):
so_line
.
_timesheet_create_task
(
project
=
map_sol_project
[
so_line
.
id
])
# project_only, task_n
ew
_project: use the project linked to the sale_order. May be create a task too.
# project_only, task_
i
n_project: use the project linked to the sale_order. May be create a task too.
for
so_line
in
so_line_new_project
:
project
=
so_line
.
project_id
# on récupère les variables de classes créées
...
...
@@ -178,7 +178,7 @@ class SaleOrderLine(models.Model):
map_so_project_templates
.
get
((
so_line
.
order_id
.
id
,
so_line
.
product_id
.
project_template_id
.
id
))
or
map_so_project
.
get
(
so_line
.
order_id
.
id
)
)
if
so_line
.
product_id
.
service_tracking
==
'
task_n
ew
_project
'
:
if
so_line
.
product_id
.
service_tracking
==
'
task_
i
n_project
'
:
if
not
project
:
if
so_line
.
product_id
.
project_template_id
:
project
=
map_so_project_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