Merge pull request #10747 from mbauskar/pos

rename Is Online field to Use POS in Offline Mode in pos settings
This commit is contained in:
rohitwaghchaure 2017-09-12 16:14:28 +05:30 committed by GitHub
commit ab64e323cd
8 changed files with 74 additions and 13 deletions

View File

@ -18,8 +18,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"default": "1", "default": "0",
"fieldname": "is_online", "fieldname": "use_pos_in_offline_mode",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
@ -28,10 +28,9 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Online", "label": "Use POS in Offline Mode",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"options": "",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
@ -55,7 +54,7 @@
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-08-30 18:34:58.960276", "modified": "2017-09-11 13:57:28.787023",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Settings", "name": "POS Settings",
@ -81,6 +80,46 @@
"share": 1, "share": 1,
"submit": 0, "submit": 0,
"write": 1 "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, "quick_entry": 1,

View File

@ -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

View File

@ -9,7 +9,7 @@ frappe.pages['pos'].on_page_load = function (wrapper) {
}); });
frappe.db.get_value('POS Settings', {name: 'POS Settings'}, 'is_online', (r) => { 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 // offline
wrapper.pos = new erpnext.pos.PointOfSale(wrapper); wrapper.pos = new erpnext.pos.PointOfSale(wrapper);
cur_pos = wrapper.pos; cur_pos = wrapper.pos;

View File

@ -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.add_more_gst_fields
erpnext.patches.v8_7.fix_purchase_receipt_status erpnext.patches.v8_7.fix_purchase_receipt_status
erpnext.patches.v8_6.rename_bom_update_tool 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.add_setup_progress_actions
erpnext.patches.v8_9.rename_company_sales_target_field erpnext.patches.v8_9.rename_company_sales_target_field
erpnext.patches.v8_8.set_bom_rate_as_per_uom erpnext.patches.v8_8.set_bom_rate_as_per_uom

View File

@ -8,5 +8,5 @@ def execute():
frappe.reload_doc('accounts', 'doctype', 'pos_settings') frappe.reload_doc('accounts', 'doctype', 'pos_settings')
doc = frappe.get_doc('POS Settings') doc = frappe.get_doc('POS Settings')
doc.is_online = 0 doc.use_pos_in_offline_mode = 1
doc.save() doc.save()

View File

@ -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) => { 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 // online
wrapper.pos = new erpnext.pos.PointOfSale(wrapper); wrapper.pos = new erpnext.pos.PointOfSale(wrapper);
window.cur_pos = wrapper.pos; window.cur_pos = wrapper.pos;

View File

@ -4,14 +4,27 @@
"docstatus": 0, "docstatus": 0,
"doctype": "Page", "doctype": "Page",
"idx": 0, "idx": 0,
"modified": "2017-08-07 17:08:56.737947", "modified": "2017-09-11 13:49:05.415211",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "point-of-sale", "name": "point-of-sale",
"owner": "Administrator", "owner": "Administrator",
"page_name": "Point of Sale", "page_name": "Point of Sale",
"restrict_to_domain": "Retail", "restrict_to_domain": "Retail",
"roles": [], "roles": [
{
"role": "Accounts User"
},
{
"role": "Accounts Manager"
},
{
"role": "Sales User"
},
{
"role": "Sales Manager"
}
],
"script": null, "script": null,
"standard": "Yes", "standard": "Yes",
"style": null, "style": null,

View File

@ -4,13 +4,13 @@ QUnit.test("test:POS Settings", function(assert) {
frappe.run_serially([ frappe.run_serially([
() => frappe.set_route('Form', 'POS Settings'), () => 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), () => frappe.timeout(0.2),
() => cur_frm.save(), () => cur_frm.save(),
() => frappe.timeout(1), () => frappe.timeout(1),
() => frappe.ui.toolbar.clear_cache(), () => frappe.ui.toolbar.clear_cache(),
() => frappe.timeout(10), () => 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), () => frappe.timeout(2),
() => done() () => done()
]); ]);