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
2956a277
Valider
2956a277
rédigé
2 déc. 2021
par
Rémi - Le Filament
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
[FIX] calculations
parent
d50643ec
Branches
Branches contenant la validation
Étiquettes
Étiquettes contenant la validation
Aucune requête de fusion associée trouvée
Modifications
3
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
models/sale_intervention.py
+17
-42
17 ajouts, 42 suppressions
models/sale_intervention.py
views/sale_intervention_view.xml
+62
-37
62 ajouts, 37 suppressions
views/sale_intervention_view.xml
views/sale_order_view.xml
+13
-2
13 ajouts, 2 suppressions
views/sale_order_view.xml
avec
92 ajouts
et
81 suppressions
models/sale_intervention.py
+
17
−
42
Voir le fichier @
2956a277
...
...
@@ -499,43 +499,38 @@ class SaleIntervention(models.Model):
# ------------------------------------------------------
# Onchange / Constraints
# ------------------------------------------------------
@api.onchange
(
"
plant_qty
"
,
"
intervention_length
"
,
"
plant_interval
"
,
"
mulch_id
"
)
@api.onchange
(
"
intervention_length
"
,
"
plant_interval
"
)
def
_onchange_length
(
self
):
if
self
.
intervention_uom_name
==
"
m
"
and
self
.
plant_interval
>
0
:
plant_qty
=
math
.
ceil
(
self
.
intervention_length
/
self
.
plant_interval
)
+
1
self
.
plant_qty
=
plant_qty
self
.
collarette_qty
=
plant_qty
@api.onchange
(
"
plant_qty
"
)
def
_onchange_plant_qty
(
self
):
if
self
.
intervention_uom_name
==
"
Unité(s)
"
:
self
.
collarette_qty
=
self
.
plant_qty
@api.onchange
(
"
plant_qty
"
,
"
intervention_length
"
,
"
mulch_id
"
)
def
_onchange_mulch_id
(
self
):
self
.
mulch_has_staples
=
False
if
self
.
mulch_unit
==
self
.
env
.
ref
(
"
uom.product_uom_meter
"
):
self
.
mulch_qty
=
(
math
.
ceil
(
self
.
intervention_length
/
self
.
plant_interval
)
+
1
)
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
"
,
"
plant_interval
"
,
"
mulch2_id
"
)
@api.onchange
(
"
plant_qty
"
,
"
intervention_length
"
,
"
mulch2_id
"
)
def
_onchange_mulch2_id
(
self
):
self
.
mulch2_has_staples
=
False
if
self
.
mulch2_unit
==
self
.
env
.
ref
(
"
uom.product_uom_meter
"
):
self
.
mulch2_qty
=
(
math
.
ceil
(
self
.
intervention_length
/
self
.
plant_interval
)
+
1
)
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
"
,
"
intervention_length
"
,
"
plant_interval
"
)
def
_onchange_plant_qty
(
self
):
if
self
.
intervention_uom_name
==
"
m
"
and
self
.
plant_interval
>
0
:
self
.
collarette_qty
=
(
math
.
ceil
(
self
.
intervention_length
/
self
.
plant_interval
)
+
1
)
elif
self
.
intervention_uom_name
==
"
Unité(s)
"
:
self
.
collarette_qty
=
self
.
plant_qty
else
:
self
.
collarette_qty
=
0
@api.onchange
(
"
high_protection_qty
"
)
def
_onchange_high_protection_qty
(
self
):
self
.
stake_qty
=
self
.
high_protection_qty
...
...
@@ -558,15 +553,13 @@ class SaleIntervention(models.Model):
%
rec
.
plant_interval
)
@api.constrains
(
"
plant_qty
"
,
"
plants_qty
"
,
"
intervention_length
"
,
"
plant_interval
"
)
@api.constrains
(
"
plant_qty
"
,
"
plants_qty
"
)
def
_check_plant_qty
(
self
):
for
rec
in
self
:
if
(
rec
.
plant_qty
!=
rec
.
plants_qty
and
rec
.
sequence_type
==
"
list
"
and
rec
.
plant_list_ids
and
rec
.
intervention_uom_name
==
"
Unité(s)
"
):
raise
UserError
(
_
(
...
...
@@ -576,23 +569,6 @@ class SaleIntervention(models.Model):
)
%
(
rec
.
plant_qty
,
rec
.
plants_qty
)
)
if
rec
.
intervention_uom_name
==
"
m
"
and
rec
.
plant_interval
>
0
:
lg_intervention
=
(
math
.
ceil
(
rec
.
intervention_length
/
rec
.
plant_interval
)
+
1
)
if
(
lg_intervention
!=
rec
.
plants_qty
and
rec
.
sequence_type
==
"
list
"
and
rec
.
plant_list_ids
):
raise
UserError
(
_
(
"
La quantité de plants renseignée
'
%d
'
est différente de
"
"
la quantité de plants calculée
'
%d
'
.
\n
"
"
Les quantités doivent être identiques, vérifier votre compositon.
"
)
%
(
lg_intervention
,
rec
.
plants_qty
)
)
@api.depends
(
"
project_subvention_id
"
,
...
...
@@ -950,7 +926,6 @@ class SaleIntervention(models.Model):
for
rec
in
res
:
seq
=
str
(
rec
.
project_id
.
intervention_counter
).
zfill
(
3
)
rec
.
name
=
rec
.
project_id
.
name
+
"
-
"
+
seq
rec
.
_create_sale_intervention_stock_lines
()
return
res
def
write
(
self
,
values
):
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
views/sale_intervention_view.xml
+
62
−
37
Voir le fichier @
2956a277
...
...
@@ -92,7 +92,10 @@
name=
"marker_id"
options=
"{'no_open': True, 'no_create': True}"
/>
<field
name=
"marker_qty"
attrs=
"{'invisible': [('marker_id', '=', False)]}"
/>
<field
name=
"marker_qty"
attrs=
"{'invisible': [('marker_id', '=', False)]}"
/>
</group>
</group>
<group
name=
"mulch"
>
...
...
@@ -101,9 +104,15 @@
name=
"mulch_id"
options=
"{'no_open': True, 'no_create': True}"
/>
<field
name=
"mulch_qty"
attrs=
"{'invisible': [('mulch_id', '=', False)]}"
/>
<field
name=
"mulch_unit"
class=
"oe_inline"
attrs=
"{'invisible': [('mulch_id', '=', False)]}"
/>
<field
name=
"mulch_qty"
attrs=
"{'invisible': [('mulch_id', '=', False)]}"
/>
<field
name=
"mulch_unit"
class=
"oe_inline"
attrs=
"{'invisible': [('mulch_id', '=', False)]}"
/>
<field
name=
"mulch_has_staples"
string=
"Avec agrafes"
...
...
@@ -118,9 +127,15 @@
name=
"mulch2_id"
options=
"{'no_open': True, 'no_create': True}"
/>
<field
name=
"mulch2_qty"
attrs=
"{'invisible': [('mulch2_id', '=', False)]}"
/>
<field
name=
"mulch2_unit"
class=
"oe_inline"
attrs=
"{'invisible': [('mulch2_id', '=', False)]}"
/>
<field
name=
"mulch2_qty"
attrs=
"{'invisible': [('mulch2_id', '=', False)]}"
/>
<field
name=
"mulch2_unit"
class=
"oe_inline"
attrs=
"{'invisible': [('mulch2_id', '=', False)]}"
/>
<field
name=
"mulch2_has_staples"
string=
"Avec agrafes"
...
...
@@ -134,26 +149,36 @@
name=
"high_protection_id"
options=
"{'no_open': True, 'no_create': True}"
/>
<field
name=
"high_protection_qty"
attrs=
"{'invisible': [('high_protection_id', '=', False)]}"
/>
<field
name=
"high_protection_qty"
attrs=
"{'invisible': [('high_protection_id', '=', False)]}"
/>
</group>
<group
name=
"stake"
>
<field
name=
"stake_id"
options=
"{'no_open': True, 'no_create': True}"
/>
<field
name=
"stake_qty"
attrs=
"{'invisible': [('stake_id', '=', False)]}"
/>
<field
name=
"stake_qty"
attrs=
"{'invisible': [('stake_id', '=', False)]}"
/>
</group>
<group
name=
"low_protection"
>
<field
name=
"low_protection_id"
options=
"{'no_open': True, 'no_create': True}"
/>
<field
name=
"low_protection_qty"
attrs=
"{'invisible': [('low_protection_id', '=', False)]}"
/>
<field
name=
"low_protection_qty"
attrs=
"{'invisible': [('low_protection_id', '=', False)]}"
/>
</group>
<group
name=
"bamboo"
>
<field
name=
"bamboo_qty"
attrs=
"{'invisible': [('low_protection_id', '=', False)]}"
/>
<field
name=
"bamboo_qty"
attrs=
"{'invisible': [('low_protection_id', '=', False)]}"
/>
</group>
</group>
<group
string=
"Composition"
>
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
views/sale_order_view.xml
+
13
−
2
Voir le fichier @
2956a277
...
...
@@ -10,10 +10,21 @@
<field
name=
"inherit_id"
ref=
"sale.view_order_form"
/>
<field
name=
"arch"
type=
"xml"
>
<button
name=
"action_quotation_send"
position=
"after"
>
<button
name=
"action_print_pdf"
string=
"Imprimer"
type=
"object"
states=
"draft"
class=
"btn-primary"
/>
<button
name=
"action_print_pdf"
string=
"Imprimer"
type=
"object"
states=
"draft"
class=
"btn-primary"
/>
</button>
<button
name=
"action_confirm"
position=
"after"
>
<button
name=
"action_print_pdf"
string=
"Imprimer"
type=
"object"
states=
"sent,sale"
/>
<button
name=
"action_print_pdf"
string=
"Imprimer"
type=
"object"
states=
"sent,sale"
/>
</button>
<label
for=
"pricelist_id"
position=
"attributes"
>
<attribute
name=
"invisible"
>
1
</attribute>
...
...
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