From fbf7d7daeffa033ffad10e192faf80a98c56e341 Mon Sep 17 00:00:00 2001 From: Julien Ortet <julien@le-filament.com> Date: Tue, 27 Feb 2024 12:41:36 +0100 Subject: [PATCH] [FIX] get only delivery prm --- views/acc_operation_views.xml | 2 +- wizard/acc_repartition_keys_wizard.py | 28 ++++++++++++++------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/views/acc_operation_views.xml b/views/acc_operation_views.xml index ac9c54c..c6837c6 100644 --- a/views/acc_operation_views.xml +++ b/views/acc_operation_views.xml @@ -8,7 +8,7 @@ <field name="inherit_id" ref="oacc.acc_operation_form_view" /> <field name="arch" type="xml"> <xpath expr="//notebook" position="inside"> - <page string="clés de répartition" name="keys"> + <page string="Clés de répartition" name="keys"> <field name="keys_repartition_ids" mode="tree"> <tree create="0"> <field name="date_send" /> diff --git a/wizard/acc_repartition_keys_wizard.py b/wizard/acc_repartition_keys_wizard.py index 1f4de09..a889ece 100644 --- a/wizard/acc_repartition_keys_wizard.py +++ b/wizard/acc_repartition_keys_wizard.py @@ -72,21 +72,23 @@ 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["acc.counter.period"] - ._get_periods_from_interval( - [("acc_operation_id", "=", self.operation_id.id)], - 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") + counter_list_from_operation = self.env[ + "acc.counter.period" + ]._get_periods_from_interval( + [("acc_operation_id", "=", self.operation_id.id)], + 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(), ) - entry_file_handler.operation_counter_list = counter_list_from_operation + 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