From 8413f76c19d239dd8d04f3eab5ae4a18c21ec1ef Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Wed, 20 Dec 2017 12:03:19 +0530 Subject: [PATCH] set the mandatory field in the backend (#12102) --- .../opening_invoice_creation_tool.py | 17 ++++++++++++----- .../opening_invoice_creation_tool_item.json | 8 ++++---- 2 files changed, 16 insertions(+), 9 deletions(-) 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 f09e8db38e..930375d491 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 @@ class OpeningInvoiceCreationTool(Document): 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 3f8ce16309..83dcffc57a 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",