Skip to content
Extraits de code Groupes Projets
Valider 90f81c4e rédigé par Julien - Le Filament's avatar Julien - Le Filament
Parcourir les fichiers

[FIX] fix nb big tree

parent 7521b15f
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -2,6 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import io
import math
import xlsxwriter
from odoo import http
from odoo.http import request
......@@ -91,13 +92,27 @@ class ApExportController(http.Controller):
return ""
def get_nb_big_trees(self, inter_id):
if inter_id.plant_sequence_ids:
to_count = inter_id.plant_sequence_ids
else:
to_count = inter_id.plant_list_ids
trees = to_count.search([("scale", "=", "big")])
return len(trees) if len(trees) > 0 else ""
nb_big = 0
if inter_id.sequence_type == "list":
nb_big = sum(plant.qty for plant in inter_id.plant_list_ids if plant.scale =="big")
elif inter_id.sequence_type == "sequence":
if inter_id.intervention_uom_name == "m" and inter_id.plant_interval != 0.0:
plants_qty = (
math.ceil(inter_id.intervention_length / inter_id.plant_interval) + 1
)
elif inter_id.intervention_uom_name == "Unité(s)":
plants_qty = inter_id.plant_qty
full_seq_qty = plants_qty // len(inter_id.plant_sequence_ids)
nb_big_in_seq = 0
for plant in inter_id.plant_sequence_ids:
if plant.scale == 'big':
nb_big_in_seq +=1
nb_big = nb_big_in_seq * full_seq_qty
return nb_big if nb_big > 0 else ""
def get_order_data(self, saison):
"""
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter