From abca3348e9fc5d7579c45403d52c83a88f330612 Mon Sep 17 00:00:00 2001 From: Julien Ortet <julien@le-filament.com> Date: Tue, 27 Feb 2024 12:56:27 +0100 Subject: [PATCH] [FIX] imrove request --- wizard/acc_repartition_keys_wizard.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/wizard/acc_repartition_keys_wizard.py b/wizard/acc_repartition_keys_wizard.py index a889ece..1eaf722 100644 --- a/wizard/acc_repartition_keys_wizard.py +++ b/wizard/acc_repartition_keys_wizard.py @@ -72,23 +72,18 @@ class AccRepartitionKeysWizard(models.TransientModel): except (ValueError, IndexError) as exc: raise UserError(_("Fichier de répartitions au mauvais format")) from exc - counter_list_from_operation = self.env[ + entry_file_handler.operation_counter_list = self.env[ "acc.counter.period" ]._get_periods_from_interval( - [("acc_operation_id", "=", self.operation_id.id)], + [("acc_operation_id", "=", self.operation_id.id), ("prm_type", "=", "delivery")], datetime.strptime( entry_file_handler.get_min_date(), "%d-%m-%Y %H:%M" ).date(), datetime.strptime( entry_file_handler.get_max_date(), "%d-%m-%Y %H:%M" ).date(), - ) + ).mapped("acc_counter_id.name") - entry_file_handler.operation_counter_list = [ - period.acc_counter_id.name - for period in counter_list_from_operation - if period.prm_type == "delivery" - ] try: file_check_result = entry_file_handler.check() except (ValueError, IndexError) as exc: -- GitLab