fix: hotbug creating sale invoice.

This commit is contained in:
a.bouhuolia
2020-12-17 20:18:06 +02:00
parent ff5768b224
commit 112eaec488
3 changed files with 26 additions and 10 deletions

View File

@@ -134,10 +134,10 @@ export default class SaleInvoicesService extends SalesInvoicesCost {
);
return {
...formatDateFields(omit(saleInvoiceDTO, ['delivered', 'entries']), [
'invoiceDate',
'dueDate',
]),
...formatDateFields(
omit(saleInvoiceDTO, ['delivered', 'entries']),
['invoiceDate', 'dueDate']
),
// Avoid rewrite the deliver date in edit mode when already published.
...(saleInvoiceDTO.delivered &&
!oldSaleInvoice?.deliveredAt && {
@@ -145,7 +145,7 @@ export default class SaleInvoicesService extends SalesInvoicesCost {
}),
balance,
paymentAmount: 0,
entries: saleInvoiceObj.entries.map((entry) => ({
entries: saleInvoiceDTO.entries.map((entry) => ({
reference_type: 'SaleInvoice',
...omit(entry, ['amount', 'id']),
})),