fix issues in sales and purchases API module.

This commit is contained in:
Ahmed Bouhuolia
2020-08-05 21:01:45 +02:00
parent 57ec5bdfbe
commit 8d4b3f1ab3
6 changed files with 52 additions and 14 deletions

View File

@@ -100,8 +100,8 @@ export default class PaymentReceiveService {
...omit(paymentReceive, ['entries']),
});
const opers = [];
const entriesIds = paymentReceive.entries.filter((i) => i.id);
const entriesShouldInsert = paymentReceive.entries.filter((i) => !i.id);
const entriesIds = paymentReceive.entries.filter((i: any) => i.id);
const entriesShouldInsert = paymentReceive.entries.filter((i: any) => !i.id);
// Detarmines which entries ids should be deleted.
const entriesIdsShouldDelete = ServiceItemsEntries.entriesShouldDeleted(
@@ -142,7 +142,7 @@ export default class PaymentReceiveService {
paymentReceive.customer_id,
oldPaymentReceive.customerId,
paymentAmount * -1,
oldPaymentReceive.amount,
oldPaymentReceive.amount * -1,
);
// Change the difference between the old and new invoice payment amount.
const diffInvoicePaymentAmount = this.saveChangeInvoicePaymentAmount(

View File

@@ -43,6 +43,7 @@ export default class SaleInvoicesService {
});
opers.push(oper);
});
// Increment the customer balance after deliver the sale invoice.
const incrementOper = Customer.incrementBalance(
saleInvoice.customer_id,
balance,