Fix: Product Sale Report would overwrite old value instead of adding to it in case the product had been updated and contained multiple product versions.
This commit is contained in:
parent
2f440a4127
commit
5402d229f8
|
@ -89,7 +89,9 @@ def product_sale_report(s: date, f: date, db: Session):
|
||||||
type_ = to_camel(VoucherType(type_).name)
|
type_ = to_camel(VoucherType(type_).name)
|
||||||
old = [i for i in info if i["id"] == id_ and i["isHappyHour"] == hh]
|
old = [i for i in info if i["id"] == id_ and i["isHappyHour"] == hh]
|
||||||
if len(old):
|
if len(old):
|
||||||
old[0][type_] = quantity
|
if type_ not in old[0]:
|
||||||
|
old[0][type_] = 0
|
||||||
|
old[0][type_] += quantity
|
||||||
else:
|
else:
|
||||||
info.append(
|
info.append(
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue