mirror of
https://bitbucket.org/presik/trytonpsk-sale_pos.git
synced 2023-12-14 07:13:02 +01:00
minor fix
This commit is contained in:
parent
3790436412
commit
ddf825e649
5
sale.py
5
sale.py
|
@ -1665,16 +1665,15 @@ class SaleByKindReport(Report):
|
||||||
from_item = from_item.join(line, condition=line.invoice == invoice.id)
|
from_item = from_item.join(line, condition=line.invoice == invoice.id)
|
||||||
if len(products_exception) > 0:
|
if len(products_exception) > 0:
|
||||||
where &= NotIn(line.product, products_exception)
|
where &= NotIn(line.product, products_exception)
|
||||||
|
columns.extend([Sum(line.quantity*line.unit_price).as_('amount_total')])
|
||||||
|
|
||||||
if data['detailed']:
|
if data['detailed']:
|
||||||
columns, group_by = cls.set_detailed_query(
|
columns, group_by = cls.set_detailed_query(
|
||||||
tables, columns, group_by)
|
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'))
|
columns.extend(cls.get_columns_kind(tables, withs, 'line_amount'))
|
||||||
query = from_item.select(*columns, where=where, group_by=group_by, with_=withs.values())
|
query = from_item.select(*columns, where=where, group_by=group_by, with_=withs.values())
|
||||||
records, totals = cls.get_values(query, records, totals, data['detailed'])
|
records, totals = cls.get_values(query, records, totals, data['detailed'])
|
||||||
|
|
||||||
report_context['records'] = records.values()
|
report_context['records'] = records.values()
|
||||||
report_context['company'] = company.rec_name
|
report_context['company'] = company.rec_name
|
||||||
report_context['total'] = totals if len(totals) > 1 else None
|
report_context['total'] = totals if len(totals) > 1 else None
|
||||||
|
@ -1692,6 +1691,7 @@ class SaleByKindReport(Report):
|
||||||
if detailed:
|
if detailed:
|
||||||
key = str(row[0]) + '_' + str(row[3])
|
key = str(row[0]) + '_' + str(row[3])
|
||||||
row_dict = {}
|
row_dict = {}
|
||||||
|
print(row, 'row')
|
||||||
for i, col in enumerate(columns):
|
for i, col in enumerate(columns):
|
||||||
if col.name.startswith('sales') or col.name.startswith('amount'):
|
if col.name.startswith('sales') or col.name.startswith('amount'):
|
||||||
try:
|
try:
|
||||||
|
@ -1703,7 +1703,6 @@ class SaleByKindReport(Report):
|
||||||
records[key].update(row_dict)
|
records[key].update(row_dict)
|
||||||
except:
|
except:
|
||||||
records[key] = row_dict
|
records[key] = row_dict
|
||||||
|
|
||||||
return records, totals
|
return records, totals
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue