fix: Graph fetch relations with sales & purchases models.

feat: Inventory tracker algorithm lots with FIFO or LIFO cost method.
This commit is contained in:
Ahmed Bouhuolia
2020-08-11 01:00:33 +02:00
parent 8d4b3f1ab3
commit 42569c89e4
25 changed files with 526 additions and 93 deletions

View File

@@ -98,8 +98,8 @@ export default class SaleEstimateService {
*/
static async isEstimateEntriesIDsExists(estimateId: number, estimate: any) {
const estimateEntriesIds = estimate.entries
.filter((e) => e.id)
.map((e) => e.id);
.filter((e: any) => e.id)
.map((e: any) => e.id);
const estimateEntries = await ItemEntry.tenant()
.query()
@@ -138,6 +138,7 @@ export default class SaleEstimateService {
.query()
.where('id', estimateId)
.withGraphFetched('entries')
.withGraphFetched('customer')
.first();
return estimate;