From ac0cb9db5a02e42d49cc0a4dc923f11215a04eeb Mon Sep 17 00:00:00 2001 From: devdiogenes Date: Fri, 19 Jul 2024 14:49:14 -0300 Subject: [PATCH] fix: Prevent set_payment_schedule when creating Sales Invoice that is return --- erpnext/stock/doctype/delivery_note/delivery_note.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index c021e22fb7eb..efb8eba16970 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -1061,7 +1061,7 @@ def get_pending_qty(item_row): automatically_fetch_payment_terms = cint( frappe.db.get_single_value("Accounts Settings", "automatically_fetch_payment_terms") ) - if automatically_fetch_payment_terms: + if automatically_fetch_payment_terms and not doc.is_return: doc.set_payment_schedule() return doc