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:
Amritanshu Agrawal 2021-08-07 17:03:16 +05:30
parent 2f440a4127
commit 5402d229f8
1 changed files with 3 additions and 1 deletions

View File

@ -89,7 +89,9 @@ def product_sale_report(s: date, f: date, db: Session):
type_ = to_camel(VoucherType(type_).name)
old = [i for i in info if i["id"] == id_ and i["isHappyHour"] == hh]
if len(old):
old[0][type_] = quantity
if type_ not in old[0]:
old[0][type_] = 0
old[0][type_] += quantity
else:
info.append(
{