Add company in report query when calculate.

Task #073006
This commit is contained in:
Juanjo Garcia 2023-01-26 10:37:45 +01:00
parent 35aedf7ad5
commit b558bd1cc9
1 changed files with 3 additions and 2 deletions

View File

@ -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()