POS Profile validation message rephrased (#11934)
* pos validation message improvised
* removed unused field
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js
index 25aff13..b62d9b0 100755
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.js
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js
@@ -106,11 +106,6 @@
};
};
-
-cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) {
- return{ query:"frappe.core.doctype.user.user.user_query"};
-};
-
cur_frm.fields_dict.write_off_account.get_query = function(doc) {
return{
filters:{
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
index 6c09c6e..e2a6b53 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -107,38 +107,6 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "user",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Applicable for User",
- "length": 0,
- "no_copy": 0,
- "oldfieldname": "user",
- "oldfieldtype": "Link",
- "options": "User",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 1,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
@@ -1508,7 +1476,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2017-11-24 14:08:09.184226",
+ "modified": "2017-12-11 17:30:45.198147",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Profile",
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py
index 5101ffd..5710bd4 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.py
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py
@@ -31,8 +31,8 @@
msgprint(_("Already set default in pos profile {0} for user {1}, kindly disabled default")
.format(res[0][0], row.user), raise_exception=1)
elif not row.default and not res:
- msgprint(_("Row {0}: set atleast one default pos profile for user {1}")
- .format(row.idx, row.user), raise_exception=1)
+ msgprint(_("User {0} doesn't have any default POS Profile. Check Default at Row {1} for this User.")
+ .format(row.user, row.idx), raise_exception=1)
def validate_all_link_fields(self):
accounts = {"Account": [self.income_account,
@@ -83,12 +83,12 @@
frappe.defaults.clear_default("is_pos")
if not include_current_pos:
- condition = " where name != '%s'" % self.name.replace("'", "\'")
+ condition = " where pfu.name != '%s' and pfu.default = 1 " % self.name.replace("'", "\'")
else:
- condition = ""
+ condition = " where pfu.default = 1 "
- pos_view_users = frappe.db.sql_list("""select user
- from `tabPOS Profile` {0}""".format(condition))
+ pos_view_users = frappe.db.sql_list("""select pfu.user
+ from `tabPOS Profile User` as pfu {0}""".format(condition))
for user in pos_view_users:
if user: