set the mandatory field in the backend (#12102)
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
index f09e8db..930375d 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
@@ -5,7 +5,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _, scrub
-from frappe.utils import flt
+from frappe.utils import flt, nowdate
from frappe.model.document import Document
@@ -69,11 +69,18 @@
if not row.qty:
row.qty = 1.0
- # set party type if not available
- if not row.party_type:
- row.party_type = "Customer" if self.invoice_type == "Sales" else "Supplier"
+ # always mandatory fields for the invoices
+ if not row.temporary_opening_account:
+ row.temporary_opening_account = get_temporary_opening_account(self.company)
+ row.party_type = "Customer" if self.invoice_type == "Sales" else "Supplier"
+ if not row.item_name:
+ row.item_name = _("Opening Invoice Item")
+ if not row.posting_date:
+ row.posting_date = nowdate()
+ if not row.due_date:
+ row.due_date = nowdate()
- for d in ("Party", "Posting Date", "Outstanding Amount", "Due Date", "Temporary Opening Account"):
+ for d in ("Party", "Outstanding Amount", "Temporary Opening Account"):
if not row.get(scrub(d)):
frappe.throw(mandatory_error_msg.format(
idx=row.idx,
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool_item/opening_invoice_creation_tool_item.json b/erpnext/accounts/doctype/opening_invoice_creation_tool_item/opening_invoice_creation_tool_item.json
index 3f8ce16..83dcffc 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool_item/opening_invoice_creation_tool_item.json
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool_item/opening_invoice_creation_tool_item.json
@@ -161,7 +161,7 @@
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
- "reqd": 1,
+ "reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -192,7 +192,7 @@
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
- "reqd": 1,
+ "reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -284,7 +284,7 @@
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
- "reqd": 0,
+ "reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -360,7 +360,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2017-12-11 17:49:14.541176",
+ "modified": "2017-12-19 05:07:01.549918",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Opening Invoice Creation Tool Item",