From 1a77922e852d3501f4cde383e215cb91e1812279 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 11 Sep 2017 11:49:25 +0530 Subject: [PATCH] rename Is Online field to Use POS in Offline Mode in pos settings --- .../doctype/pos_settings/pos_settings.json | 49 +++++++++++++++++-- .../doctype/pos_settings/test_pos_settings.py | 9 ++++ erpnext/accounts/page/pos/pos.js | 2 +- erpnext/patches.txt | 2 +- .../v8_7/set_offline_in_pos_settings.py | 2 +- .../page/point_of_sale/point_of_sale.js | 2 +- .../page/point_of_sale/point_of_sale.json | 17 ++++++- .../point_of_sale/tests/test_pos_settings.js | 4 +- 8 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 erpnext/accounts/doctype/pos_settings/test_pos_settings.py diff --git a/erpnext/accounts/doctype/pos_settings/pos_settings.json b/erpnext/accounts/doctype/pos_settings/pos_settings.json index a04558da26..8f5b631c89 100644 --- a/erpnext/accounts/doctype/pos_settings/pos_settings.json +++ b/erpnext/accounts/doctype/pos_settings/pos_settings.json @@ -18,8 +18,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "1", - "fieldname": "is_online", + "default": "0", + "fieldname": "use_pos_in_offline_mode", "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, @@ -28,10 +28,9 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Online", + "label": "Use POS in Offline Mode", "length": 0, "no_copy": 0, - "options": "", "permlevel": 0, "precision": "", "print_hide": 0, @@ -55,7 +54,7 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2017-08-30 18:34:58.960276", + "modified": "2017-09-11 13:57:28.787023", "modified_by": "Administrator", "module": "Accounts", "name": "POS Settings", @@ -81,6 +80,46 @@ "share": 1, "submit": 0, "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 0, + "role": "Accounts User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 0, + "role": "Sales User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 } ], "quick_entry": 1, diff --git a/erpnext/accounts/doctype/pos_settings/test_pos_settings.py b/erpnext/accounts/doctype/pos_settings/test_pos_settings.py new file mode 100644 index 0000000000..a3df10803c --- /dev/null +++ b/erpnext/accounts/doctype/pos_settings/test_pos_settings.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +import unittest + +class TestPOSSettings(unittest.TestCase): + pass diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index 2f425248a1..4b1e3900bb 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -9,7 +9,7 @@ frappe.pages['pos'].on_page_load = function (wrapper) { }); frappe.db.get_value('POS Settings', {name: 'POS Settings'}, 'is_online', (r) => { - if (r && r.is_online && !cint(r.is_online)) { + if (r && r.use_pos_in_offline_mode && cint(r.use_pos_in_offline_mode)) { // offline wrapper.pos = new erpnext.pos.PointOfSale(wrapper); cur_pos = wrapper.pos; diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 50c64b5a16..6829bd4033 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -435,7 +435,7 @@ erpnext.patches.v8_5.remove_project_type_property_setter erpnext.patches.v8_7.add_more_gst_fields erpnext.patches.v8_7.fix_purchase_receipt_status erpnext.patches.v8_6.rename_bom_update_tool -erpnext.patches.v8_7.set_offline_in_pos_settings +erpnext.patches.v8_7.set_offline_in_pos_settings #11-09-17 erpnext.patches.v8_9.add_setup_progress_actions erpnext.patches.v8_9.rename_company_sales_target_field erpnext.patches.v8_8.set_bom_rate_as_per_uom diff --git a/erpnext/patches/v8_7/set_offline_in_pos_settings.py b/erpnext/patches/v8_7/set_offline_in_pos_settings.py index 64a3a7c806..b24fe37a28 100644 --- a/erpnext/patches/v8_7/set_offline_in_pos_settings.py +++ b/erpnext/patches/v8_7/set_offline_in_pos_settings.py @@ -8,5 +8,5 @@ def execute(): frappe.reload_doc('accounts', 'doctype', 'pos_settings') doc = frappe.get_doc('POS Settings') - doc.is_online = 0 + doc.use_pos_in_offline_mode = 1 doc.save() \ No newline at end of file diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index 9cd2a49912..d4b7eba107 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -9,7 +9,7 @@ frappe.pages['point-of-sale'].on_page_load = function(wrapper) { }); frappe.db.get_value('POS Settings', {name: 'POS Settings'}, 'is_online', (r) => { - if (r && r.is_online && cint(r.is_online)) { + if (r && r.use_pos_in_offline_mode && !cint(r.use_pos_in_offline_mode)) { // online wrapper.pos = new erpnext.pos.PointOfSale(wrapper); window.cur_pos = wrapper.pos; diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.json b/erpnext/selling/page/point_of_sale/point_of_sale.json index 1e348c09af..6d2f5f2f8d 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.json +++ b/erpnext/selling/page/point_of_sale/point_of_sale.json @@ -4,14 +4,27 @@ "docstatus": 0, "doctype": "Page", "idx": 0, - "modified": "2017-08-07 17:08:56.737947", + "modified": "2017-09-11 13:49:05.415211", "modified_by": "Administrator", "module": "Selling", "name": "point-of-sale", "owner": "Administrator", "page_name": "Point of Sale", "restrict_to_domain": "Retail", - "roles": [], + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Sales User" + }, + { + "role": "Sales Manager" + } + ], "script": null, "standard": "Yes", "style": null, diff --git a/erpnext/selling/page/point_of_sale/tests/test_pos_settings.js b/erpnext/selling/page/point_of_sale/tests/test_pos_settings.js index d9b8cf8274..9b02e54802 100644 --- a/erpnext/selling/page/point_of_sale/tests/test_pos_settings.js +++ b/erpnext/selling/page/point_of_sale/tests/test_pos_settings.js @@ -4,13 +4,13 @@ QUnit.test("test:POS Settings", function(assert) { frappe.run_serially([ () => frappe.set_route('Form', 'POS Settings'), - () => cur_frm.set_value('is_online', 1), + () => cur_frm.set_value('use_pos_in_offline_mode', 0), () => frappe.timeout(0.2), () => cur_frm.save(), () => frappe.timeout(1), () => frappe.ui.toolbar.clear_cache(), () => frappe.timeout(10), - () => assert.ok(cur_frm.doc.is_online==1, "Enabled online"), + () => assert.ok(cur_frm.doc.use_pos_in_offline_mode==0, "Enabled online"), () => frappe.timeout(2), () => done() ]);