make due date, invoice_portion mandatory

This commit is contained in:
tunde 2017-09-22 16:22:15 +01:00
parent e6b3fe1215
commit 3aec78b472
2 changed files with 7 additions and 4 deletions

View File

@ -81,6 +81,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2, "columns": 2,
"default": "0",
"fieldname": "invoice_portion", "fieldname": "invoice_portion",
"fieldtype": "Percent", "fieldtype": "Percent",
"hidden": 0, "hidden": 0,
@ -101,7 +102,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
@ -132,7 +133,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
@ -143,6 +144,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 2, "columns": 2,
"default": "0",
"depends_on": "eval:in_list(['Day(s) after invoice date', 'Day(s) after the end of the invoice month'], doc.due_date_based_on)", "depends_on": "eval:in_list(['Day(s) after invoice date', 'Day(s) after the end of the invoice month'], doc.due_date_based_on)",
"fieldname": "credit_days", "fieldname": "credit_days",
"fieldtype": "Int", "fieldtype": "Int",
@ -175,6 +177,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"default": "0",
"depends_on": "eval:doc.due_date_based_on=='Month(s) after the end of the invoice month'", "depends_on": "eval:doc.due_date_based_on=='Month(s) after the end of the invoice month'",
"fieldname": "credit_months", "fieldname": "credit_months",
"fieldtype": "Int", "fieldtype": "Int",
@ -211,7 +214,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-08-10 16:27:31.401380", "modified": "2017-09-22 11:15:02.585019",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Terms Template Detail", "name": "Payment Terms Template Detail",

View File

@ -666,7 +666,7 @@ class AccountsController(TransactionBase):
def validate_invoice_portion(self): def validate_invoice_portion(self):
total_portion = 0 total_portion = 0
for term in self.payment_schedule: for term in self.payment_schedule:
total_portion += term.invoice_portion total_portion += flt(term.get('invoice_portion', 0))
if flt(total_portion, 2) != 100.00: if flt(total_portion, 2) != 100.00:
frappe.msgprint(_('Combined invoice portion must equal 100%'), raise_exception=1, indicator='red') frappe.msgprint(_('Combined invoice portion must equal 100%'), raise_exception=1, indicator='red')