diff --git a/models/acc_enedis_cdc.py b/models/acc_enedis_cdc.py index bedd9bdeb2e0712fd593b2e2d34241f51d05b961..8f81a37ef2477a3d1bf8547d6c6ef8df3438a218 100644 --- a/models/acc_enedis_cdc.py +++ b/models/acc_enedis_cdc.py @@ -123,7 +123,9 @@ class AccEnedisCdc(models.Model): else: start_date_upd = max(start_date, period_ids[0].start_date) if period_ids[-1].end_date: - end_date_upd = min(end_date, period_ids[-1].end_date) + end_date_upd = min( + end_date, period_ids[-1].end_date + timedelta(days=1) + ) else: end_date_upd = end_date desc = ( @@ -266,7 +268,9 @@ class AccEnedisCdc(models.Model): type_curve = curve["type"] for point in curve["interval_reading"]: - date_slot = datetime.strptime(point["timestamp"], "%Y-%m-%dT%H:%M:%SZ") + date_slot = datetime.strptime( + point["timestamp"], "%Y-%m-%dT%H:%M:%SZ" + ) self.env["acc.enedis.cdc"].create( { "name": name, @@ -275,14 +279,18 @@ class AccEnedisCdc(models.Model): "comp_data_type": type_curve, "power": point["value"], "date_slot": date_slot, - "timestep": timestep + "timestep": timestep, } ) # Update partner_id for retrieved cdc domain = [ ("acc_operation_id", "=", operation.id), ("acc_counter_id", "=", usage_point_id.id or False), - ("prm_type", "=", "delivery" if type_prm == "cons" else "injection"), + ( + "prm_type", + "=", + "delivery" if type_prm == "cons" else "injection", + ), ] self.env["acc.counter.period"]._get_periods_from_interval( domain, start_date, end_date