From 4f350fcadb93f0cf6880bb2818d80a0aef4691d3 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Fri, 1 Mar 2019 16:38:58 +0530 Subject: [PATCH] feat: validate sales order in sales invoice --- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 2 +- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 773d1cfe06..78c39bd430 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -158,7 +158,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte }, get_query_filters: { docstatus: 1, - status: ["!=", "Closed"], + status: ["not in", ["Closed", "On Hold"]], per_billed: ["<", 99.99], company: me.frm.doc.company } diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 4cf3a1acf5..6375413a75 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -81,7 +81,7 @@ class SalesInvoice(SellingController): self.validate_with_previous_doc() self.validate_uom_is_integer("stock_uom", "stock_qty") self.validate_uom_is_integer("uom", "qty") - self.check_close_sales_order("sales_order") + self.check_sales_order_on_hold_or_close("sales_order") self.validate_debit_to_acc() self.clear_unallocated_advances("Sales Invoice Advance", "advances") self.add_remarks() @@ -206,7 +206,7 @@ class SalesInvoice(SellingController): self.update_time_sheet(None) def on_cancel(self): - self.check_close_sales_order("sales_order") + self.check_sales_order_on_hold_or_close("sales_order") from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):