[Fix] Pos bugs (#16256)
* Remove hard-coded values
* Fix change pos profile + add campaign
* Test case for coveralls
* Remove unnecessary method
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 91f3711..04c8718 100755
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -1135,16 +1135,18 @@
},
apply_category: function() {
- var me = this;
- category = this.selected_item_group || "All Item Groups";
+ frappe.db.get_value("Item Group", {lft: 1, is_group: 1}, "name", (r) => {
+ category = this.selected_item_group || r.name;
- if(category == 'All Item Groups') {
- return this.item_data
- } else {
- return this.item_data.filter(function(element, index, array){
- return element.item_group == category;
- });
- }
+ if(category == r.name) {
+ return this.item_data
+ } else {
+ return this.item_data.filter(function(element, index, array){
+ return element.item_group == category;
+ });
+ }
+ })
+
},
bind_items_event: function() {