From ff7364621275ea8bec54b6e6c5876955acc72555 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 8 Nov 2017 14:34:38 +0530 Subject: [PATCH] Made POS Profile mandatory and changed test order --- erpnext/accounts/doctype/sales_invoice/pos.py | 2 ++ erpnext/patches/v9_0/add_user_to_child_table_in_pos_profile.py | 3 ++- erpnext/selling/page/point_of_sale/point_of_sale.js | 3 +++ erpnext/tests/ui/tests.txt | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index 36c2365357..63db16ca55 100644 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -16,6 +16,8 @@ def get_pos_data(): doc = frappe.new_doc('Sales Invoice') doc.is_pos = 1; pos_profile = get_pos_profile(doc.company) or {} + if not pos_profile: + frappe.throw(_("POS Profile is required to use Point-of-Sale")) if not doc.company: doc.company = pos_profile.get('company') doc.update_stock = pos_profile.get('update_stock') diff --git a/erpnext/patches/v9_0/add_user_to_child_table_in_pos_profile.py b/erpnext/patches/v9_0/add_user_to_child_table_in_pos_profile.py index b2093c6c6f..e7833c0f5c 100644 --- a/erpnext/patches/v9_0/add_user_to_child_table_in_pos_profile.py +++ b/erpnext/patches/v9_0/add_user_to_child_table_in_pos_profile.py @@ -6,7 +6,8 @@ import frappe def execute(): doctype = 'POS Profile' - frappe.reload_doctype(doctype) + frappe.reload_doc('accounts', 'doctype', doctype) + frappe.reload_doc('accounts', 'doctype', 'POS Profile User') for doc in frappe.get_all(doctype): _doc = frappe.get_doc(doctype, doc.name) 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 56b341f30d..cc22966f5c 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -326,6 +326,9 @@ erpnext.pos.PointOfSale = class PointOfSale { __('Select POS Profile') ); } + } else { + frappe.dom.unfreeze(); + frappe.throw(__("POS Profile is required to use Point-of-Sale")); } }); }); diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index 24858f3646..6cf379472c 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -50,8 +50,8 @@ erpnext/schools/doctype/room/test_room.js erpnext/schools/doctype/instructor/test_instructor.js erpnext/stock/doctype/warehouse/test_warehouse.js erpnext/manufacturing/doctype/production_order/test_production_order.js #long -erpnext/selling/page/point_of_sale/tests/test_point_of_sale.js erpnext/accounts/page/pos/test_pos.js +erpnext/selling/page/point_of_sale/tests/test_point_of_sale.js erpnext/selling/doctype/product_bundle/test_product_bundle.js erpnext/stock/doctype/delivery_note/test_delivery_note.js erpnext/stock/doctype/material_request/tests/test_material_request.js