minor fix

This commit is contained in:
wilsongomez 2022-06-14 15:24:08 -05:00
parent 3790436412
commit ddf825e649

View file

@ -1665,16 +1665,15 @@ class SaleByKindReport(Report):
from_item = from_item.join(line, condition=line.invoice == invoice.id)
if len(products_exception) > 0:
where &= NotIn(line.product, products_exception)
columns.extend([Sum(line.quantity*line.unit_price).as_('amount_total')])
if data['detailed']:
columns, group_by = cls.set_detailed_query(
tables, columns, group_by)
columns.extend([Sum(line.quantity*line.unit_price).as_('amount_total')])
columns.extend(cls.get_columns_kind(tables, withs, 'line_amount'))
query = from_item.select(*columns, where=where, group_by=group_by, with_=withs.values())
records, totals = cls.get_values(query, records, totals, data['detailed'])
report_context['records'] = records.values()
report_context['company'] = company.rec_name
report_context['total'] = totals if len(totals) > 1 else None
@ -1692,6 +1691,7 @@ class SaleByKindReport(Report):
if detailed:
key = str(row[0]) + '_' + str(row[3])
row_dict = {}
print(row, 'row')
for i, col in enumerate(columns):
if col.name.startswith('sales') or col.name.startswith('amount'):
try:
@ -1703,7 +1703,6 @@ class SaleByKindReport(Report):
records[key].update(row_dict)
except:
records[key] = row_dict
return records, totals