Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
A
ap_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
Arbre et Paysage
ap_sale_project
Validations
1de1fe79
Valider
1de1fe79
rédigé
16 nov. 2021
par
Juliana
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
[ADD]Add onchange qty
parent
5782ebea
Branches
Branches contenant la validation
Étiquettes
Étiquettes contenant la validation
Aucune requête de fusion associée trouvée
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
models/sale_intervention.py
+46
-5
46 ajouts, 5 suppressions
models/sale_intervention.py
avec
46 ajouts
et
5 suppressions
models/sale_intervention.py
+
46
−
5
Voir le fichier @
1de1fe79
...
...
@@ -83,9 +83,7 @@ class SaleIntervention(models.Model):
# FOURNITURES
is_collarette
=
fields
.
Boolean
(
"
Collerettes
"
)
# TODO : add a default_quantity field on product_template and take
# the following from there ?
collarette_qty
=
fields
.
Integer
(
"
Nombre de collerettes
"
,
default
=
1
)
collarette_qty
=
fields
.
Integer
(
"
Nombre de collerettes
"
)
# Mulch Fields
mulch_id
=
fields
.
Many2one
(
...
...
@@ -148,7 +146,7 @@ class SaleIntervention(models.Model):
],
ondelete
=
"
restrict
"
,
)
stake_qty
=
fields
.
Float
(
"
Qté Piquets
"
,
default
=
1
)
stake_qty
=
fields
.
Float
(
"
Qté Piquets
"
)
# Low protection
low_protection_id
=
fields
.
Many2one
(
...
...
@@ -169,7 +167,7 @@ class SaleIntervention(models.Model):
(avec protections entrées au dessus)
"
,
)
bamboo_qty
=
fields
.
Integer
(
"
Qté bambous
"
,
default
=
2
)
bamboo_qty
=
fields
.
Integer
(
"
Qté bambous
"
)
# Markers (Jalons)
marker_id
=
fields
.
Many2one
(
...
...
@@ -425,6 +423,49 @@ class SaleIntervention(models.Model):
# ------------------------------------------------------
# Onchange / Constraints
# ------------------------------------------------------
@api.onchange
(
'
plant_qty
'
,
'
intervention_length
'
,
'
mulch_id
'
)
def
_onchange_mulch_id
(
self
):
if
self
.
mulch_unit
==
self
.
env
.
ref
(
"
uom.product_uom_meter
"
):
self
.
mulch_qty
=
self
.
intervention_length
elif
self
.
mulch_unit
==
self
.
env
.
ref
(
"
uom.product_uom_unit
"
):
self
.
mulch_qty
=
self
.
plant_qty
else
:
self
.
mulch_qty
=
0.0
@api.onchange
(
'
plant_qty
'
,
'
intervention_length
'
,
'
mulch2_id
'
)
def
_onchange_mulch2_id
(
self
):
if
self
.
mulch2_unit
==
self
.
env
.
ref
(
"
uom.product_uom_meter
"
):
self
.
mulch2_qty
=
self
.
intervention_length
elif
self
.
mulch2_unit
==
self
.
env
.
ref
(
"
uom.product_uom_unit
"
):
self
.
mulch2_qty
=
self
.
plant_qty
else
:
self
.
mulch2_qty
=
0.0
@api.onchange
(
'
plant_qty
'
)
def
_onchange_plant_qty
(
self
):
self
.
collarette_qty
=
self
.
plant_qty
@api.onchange
(
"
high_protection_id
"
)
def
_onchange_high_protection_id
(
self
):
if
not
self
.
high_protection_id
:
self
.
high_protection_qty
=
0.0
@api.onchange
(
"
high_protection_qty
"
,
"
stake_id
"
)
def
_onchange_high_protection_qty
(
self
):
if
self
.
stake_id
:
self
.
stake_qty
=
self
.
high_protection_qty
else
:
self
.
stake_qty
=
0.0
@api.onchange
(
"
low_protection_id
"
)
def
_onchange_low_protection_id
(
self
):
if
not
self
.
low_protection_id
:
self
.
low_protection_qty
=
0.0
@api.onchange
(
"
low_protection_qty
"
)
def
_onchange_low_protection_qty
(
self
):
self
.
bamboo_qty
=
self
.
low_protection_qty
*
2
@api.constrains
(
"
plant_interval
"
)
def
_check_plant_interval
(
self
):
for
rec
in
self
:
...
...
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