fix: Prevent set_payment_schedule when creating Sales Invoice that is return

This commit is contained in:
devdiogenes
2024-07-19 14:49:14 -03:00
parent ea03ce3662
commit ac0cb9db5a

View File

@@ -1061,7 +1061,7 @@ def make_sales_invoice(source_name, target_doc=None, args=None):
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