minor fix

This commit is contained in:
wilson gomez 2022-02-04 12:07:58 -05:00
parent 3733f079e7
commit 00c6ed1f05

10
sale.py
View file

@ -7,7 +7,7 @@ from itertools import chain
from sql import Table
from sql import Null
from sql.operators import NotIn
from sql.operators import NotIn, Or
from sql.aggregate import Sum, Count
from sql.conditionals import Case
@ -1713,7 +1713,9 @@ class SaleByKindReport(Report):
]
else:
columns_ = [
Sum(Case((sale.kind == Null or sale.kind == '', 1), else_=0)).as_('sales_'+k),
Sum(Case(
(((sale.kind == '') | (sale.kind == Null)), 1)
, else_=0)).as_('sales_'+k),
]
columns1.extend(columns_)
query = sale.join(shop, condition=shop.id == sale.shop
@ -1746,7 +1748,9 @@ class SaleByKindReport(Report):
]
else:
columns_ = [
Sum(Case((sale.kind == Null or sale.kind == '', (line.quantity*line.unit_price)), else_=0)).as_('amount_'+k),
Sum(Case(
(((sale.kind == '') | (sale.kind == Null)), (line.quantity*line.unit_price)),
else_=0)).as_('amount_'+k),
]
columns2.extend(columns_)