diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py index a24a5ed0c0d4a743b6725b81bca374cef341242f..32635fa4ec7759a6606fd2ad9ef6a22d8b3c08d3 100644 --- a/erpnext/regional/italy/utils.py +++ b/erpnext/regional/italy/utils.py @@ -330,24 +330,19 @@ def sales_invoice_on_submit(doc, method): ]: return - if not len(doc.payment_schedule): - frappe.throw(_("Please set the Payment Schedule"), title=_("E-Invoicing Information Missing")) - else: - for schedule in doc.payment_schedule: - if not schedule.mode_of_payment: - frappe.throw( - _("Row {0}: Please set the Mode of Payment in Payment Schedule").format(schedule.idx), - title=_("E-Invoicing Information Missing"), - ) - elif not frappe.db.get_value( - "Mode of Payment", schedule.mode_of_payment, "mode_of_payment_code" - ): - frappe.throw( - _("Row {0}: Please set the correct code on Mode of Payment {1}").format( - schedule.idx, schedule.mode_of_payment - ), - title=_("E-Invoicing Information Missing"), - ) + for schedule in doc.payment_schedule: + if not schedule.mode_of_payment: + frappe.throw( + _("Row {0}: Please set the Mode of Payment in Payment Schedule").format(schedule.idx), + title=_("E-Invoicing Information Missing"), + ) + elif not frappe.db.get_value("Mode of Payment", schedule.mode_of_payment, "mode_of_payment_code"): + frappe.throw( + _("Row {0}: Please set the correct code on Mode of Payment {1}").format( + schedule.idx, schedule.mode_of_payment + ), + title=_("E-Invoicing Information Missing"), + ) prepare_and_attach_invoice(doc)