fix: provide initial value for .reduce() call

Fixes the error "TypeError: Reduce of empty array with no initial value" (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Reduce_of_empty_array_with_no_initial_value#invalid_cases)

(cherry picked from commit 65f80abf2f)
This commit is contained in:
barredterra
2024-07-20 00:44:31 +02:00
committed by Mergify
parent 926fd41a2b
commit 72bc539ffd

View File

@@ -157,7 +157,7 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
const payment_is_overdue = doc.payment_schedule
.map((row) => Date.parse(row.due_date) < Date.now())
.reduce((prev, current) => prev || current);
.reduce((prev, current) => prev || current, false);
if (payment_is_overdue) {
this.frm.add_custom_button(