set the mandatory field in the backend (#12102)
This commit is contained in:
parent
c8ecfa15f3
commit
8413f76c19
@ -5,7 +5,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _, scrub
|
from frappe import _, scrub
|
||||||
from frappe.utils import flt
|
from frappe.utils import flt, nowdate
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
|
||||||
@ -69,11 +69,18 @@ class OpeningInvoiceCreationTool(Document):
|
|||||||
if not row.qty:
|
if not row.qty:
|
||||||
row.qty = 1.0
|
row.qty = 1.0
|
||||||
|
|
||||||
# set party type if not available
|
# always mandatory fields for the invoices
|
||||||
if not row.party_type:
|
if not row.temporary_opening_account:
|
||||||
row.party_type = "Customer" if self.invoice_type == "Sales" else "Supplier"
|
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)):
|
if not row.get(scrub(d)):
|
||||||
frappe.throw(mandatory_error_msg.format(
|
frappe.throw(mandatory_error_msg.format(
|
||||||
idx=row.idx,
|
idx=row.idx,
|
||||||
|
@ -161,7 +161,7 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
@ -192,7 +192,7 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
@ -284,7 +284,7 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 1,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
@ -360,7 +360,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-12-11 17:49:14.541176",
|
"modified": "2017-12-19 05:07:01.549918",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Opening Invoice Creation Tool Item",
|
"name": "Opening Invoice Creation Tool Item",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user