From b558bd1cc9e310ad67cc5348a2eb8fdc82e47eea Mon Sep 17 00:00:00 2001 From: Juanjo Garcia Date: Thu, 26 Jan 2023 10:37:45 +0100 Subject: [PATCH] Add company in report query when calculate. Task #073006 --- aeat.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aeat.py b/aeat.py index f1609bf..83d4f07 100644 --- a/aeat.py +++ b/aeat.py @@ -345,12 +345,13 @@ class Report(Workflow, ModelSQL, ModelView): aeat_347_record as r WHERE r.year = %s AND - r.party_tax_identifier is not null + r.party_tax_identifier is not null AND + r.company = %s GROUP BY r.party_tax_identifier, r.operation_key HAVING sum(amount) > %s - """ % (cls.aggregate_function(), report.year, + """ % (cls.aggregate_function(), report.year, report.company.id, report.operation_limit) cursor.execute(query) result = cursor.fetchall()