diff --git a/modules/account_es/reporting_tax.py b/modules/account_es/reporting_tax.py index 6d711bb6cb..dd266de231 100644 --- a/modules/account_es/reporting_tax.py +++ b/modules/account_es/reporting_tax.py @@ -271,7 +271,7 @@ class AEAT303(AEATReport): context = super().get_context(records, header, data) amounts = context['amounts'] - periods = records + periods = sorted(records, key=attrgetter('start_date')) start_date = periods[0].start_date end_date = periods[-1].end_date