From ea723e59c696c1224fca2ddd8051170cdf8a36a0 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Tue, 12 Dec 2017 14:24:00 +0530 Subject: [PATCH] POS Profile validation message rephrased (#11934) * pos validation message improvised * removed unused field --- .../doctype/pos_profile/pos_profile.js | 5 --- .../doctype/pos_profile/pos_profile.json | 34 +------------------ .../doctype/pos_profile/pos_profile.py | 12 +++---- 3 files changed, 7 insertions(+), 44 deletions(-) diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js index 25aff13693..b62d9b0b60 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['select_print_heading'].get_query = function(doc, cdt, cdn) }; }; - -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 6c09c6e317..e2a6b53f28 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.json +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json @@ -101,38 +101,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "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, @@ -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 5101ffd42b..5710bd4f3e 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py @@ -31,8 +31,8 @@ class POSProfile(Document): 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 @@ class POSProfile(Document): 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: