diff --git a/core/service.h b/core/service.h index 69c9d78..6dcf5ac 100644 --- a/core/service.h +++ b/core/service.h @@ -156,7 +156,7 @@ public: pSession = ptrSession.data(); } - *pSession += qx::dao::delete_by_id(entity); + *pSession += qx::dao::delete_by_id(entity, pSession->database()); if (!pSession->isValid()) { qDebug() << pSession->firstError().text(); diff --git a/shop/shopservice.cpp b/shop/shopservice.cpp index 9e17a10..ce77cb1 100644 --- a/shop/shopservice.cpp +++ b/shop/shopservice.cpp @@ -60,10 +60,6 @@ void ShopService::calculate(VoucherPtr voucher) loadSettings(); - if (voucher->items().isEmpty()) { - load(voucher); - } - foreach (QSharedPointer item, voucher->items()) { if (item->refId() == ROUNDING_ITEM) @@ -384,6 +380,9 @@ void ShopService::moveItems(QList items, VoucherPtr source, Vouc it->setVoucher(target); } + calculate(target); + update(target, &session); + if (source->items().isEmpty()) { erase(source, &session);