From ea18579c2378b65b82d7527d9848bb15ff00c669 Mon Sep 17 00:00:00 2001 From: Madcheese101 <40042269+Madcheese101@users.noreply.github.com> Date: Thu, 14 Sep 2023 01:49:13 +0200 Subject: [PATCH 1/4] Feat: Optional Attribute Filters - Now has options to add two attribute filters (2 select fields) - Changed Item Group filter location to the top bar for better UX --- posawesome/fixtures/custom_field.json | 653 +++++++++++++----- posawesome/hooks.py | 6 +- posawesome/posawesome/api/posapp.py | 116 ++-- .../posapp/components/pos/ItemsSelector.vue | 125 +++- 4 files changed, 658 insertions(+), 242 deletions(-) diff --git a/posawesome/fixtures/custom_field.json b/posawesome/fixtures/custom_field.json index fd6d13bb3..6d46fe05f 100644 --- a/posawesome/fixtures/custom_field.json +++ b/posawesome/fixtures/custom_field.json @@ -48,6 +48,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -101,6 +102,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 1, "unique": 0, "width": null @@ -154,6 +156,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 1, "unique": 0, "width": null @@ -207,6 +210,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 1, "unique": 0, "width": null @@ -260,6 +264,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -313,6 +318,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 1, "unique": 0, "width": null @@ -366,6 +372,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -377,16 +384,16 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": "0", + "default": null, "depends_on": null, - "description": null, + "description": "For POS Closing Shift Payment Reconciliation", "docstatus": 0, "doctype": "Custom Field", - "dt": "Customer", + "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_discount", - "fieldtype": "Float", + "fieldname": "posa_cash_mode_of_payment", + "fieldtype": "Link", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -397,18 +404,18 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "lead_name", + "insert_after": "posa_pos_awesome_settings", "is_system_generated": 0, "is_virtual": 0, - "label": "Discount %", + "label": "Cash Mode of Payment", "length": 0, "mandatory_depends_on": null, - "modified": "2021-06-04 21:02:31.784347", + "modified": "2021-03-06 00:29:24.240940", "module": null, - "name": "Customer-posa_discount", + "name": "POS Profile-posa_cash_mode_of_payment", "no_copy": 0, - "non_negative": 1, - "options": null, + "non_negative": 0, + "options": "Mode of Payment", "permlevel": 0, "precision": "", "print_hide": 0, @@ -419,6 +426,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -430,16 +438,16 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": null, + "default": "0", "depends_on": null, - "description": "For POS Closing Shift Payment Reconciliation", + "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "POS Profile", + "dt": "Batch", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_cash_mode_of_payment", - "fieldtype": "Link", + "fieldname": "posa_batch_price", + "fieldtype": "Float", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -450,18 +458,18 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_pos_awesome_settings", + "insert_after": "manufacturing_date", "is_system_generated": 0, "is_virtual": 0, - "label": "Cash Mode of Payment", + "label": "Price", "length": 0, "mandatory_depends_on": null, - "modified": "2021-03-06 00:29:24.240940", + "modified": "2020-10-26 02:31:58.913688", "module": null, - "name": "POS Profile-posa_cash_mode_of_payment", + "name": "Batch-posa_batch_price", "no_copy": 0, "non_negative": 0, - "options": "Mode of Payment", + "options": null, "permlevel": 0, "precision": "", "print_hide": 0, @@ -472,6 +480,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -488,11 +497,11 @@ "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Batch", + "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_batch_price", - "fieldtype": "Float", + "fieldname": "posa_allow_delete", + "fieldtype": "Check", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -503,15 +512,15 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "manufacturing_date", + "insert_after": "posa_cash_mode_of_payment", "is_system_generated": 0, "is_virtual": 0, - "label": "Price", + "label": "Auto Delete Draft Invoice", "length": 0, "mandatory_depends_on": null, - "modified": "2020-10-26 02:31:58.913688", + "modified": "2020-10-09 16:01:30.649938", "module": null, - "name": "Batch-posa_batch_price", + "name": "POS Profile-posa_allow_delete", "no_copy": 0, "non_negative": 0, "options": null, @@ -525,6 +534,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -541,11 +551,11 @@ "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "POS Profile", + "dt": "Customer", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_allow_delete", - "fieldtype": "Check", + "fieldname": "posa_discount", + "fieldtype": "Float", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -556,17 +566,17 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_cash_mode_of_payment", + "insert_after": "lead_name", "is_system_generated": 0, "is_virtual": 0, - "label": "Auto Delete Draft Invoice", + "label": "Discount %", "length": 0, "mandatory_depends_on": null, - "modified": "2020-10-09 16:01:30.649938", + "modified": "2021-06-04 21:02:31.784347", "module": null, - "name": "POS Profile-posa_allow_delete", + "name": "Customer-posa_discount", "no_copy": 0, - "non_negative": 0, + "non_negative": 1, "options": null, "permlevel": 0, "precision": "", @@ -578,6 +588,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -631,6 +642,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -684,6 +696,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -737,6 +750,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -790,6 +804,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -843,6 +858,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 1, "unique": 0, "width": null @@ -896,6 +912,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -949,6 +966,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -960,16 +978,16 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": "", + "default": null, "depends_on": null, "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Address", + "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_delivery_charges", - "fieldtype": "Link", + "fieldname": "posa_allow_change_posting_date", + "fieldtype": "Check", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -980,18 +998,18 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "is_shipping_address", + "insert_after": "posa_scale_barcode_start", "is_system_generated": 0, "is_virtual": 0, - "label": "Delivery Charges", + "label": "Allow Change Posting Date", "length": 0, "mandatory_depends_on": null, - "modified": "2022-07-24 17:20:00.246026", + "modified": "2022-12-16 11:20:05.134781", "module": null, - "name": "Address-posa_delivery_charges", + "name": "POS Profile-posa_allow_change_posting_date", "no_copy": 0, "non_negative": 0, - "options": "Delivery Charges", + "options": null, "permlevel": 0, "precision": "", "print_hide": 0, @@ -1002,6 +1020,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1021,7 +1040,7 @@ "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_allow_change_posting_date", + "fieldname": "posa_default_card_view", "fieldtype": "Check", "hidden": 0, "hide_border": 0, @@ -1033,15 +1052,15 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_scale_barcode_start", + "insert_after": "posa_allow_change_posting_date", "is_system_generated": 0, "is_virtual": 0, - "label": "Allow Change Posting Date", + "label": "Default Card View", "length": 0, "mandatory_depends_on": null, - "modified": "2022-12-16 11:20:05.134781", + "modified": "2023-03-12 14:03:44.088542", "module": null, - "name": "POS Profile-posa_allow_change_posting_date", + "name": "POS Profile-posa_default_card_view", "no_copy": 0, "non_negative": 0, "options": null, @@ -1055,6 +1074,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1066,16 +1086,16 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": null, + "default": "", "depends_on": null, "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "POS Profile", + "dt": "Address", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_default_card_view", - "fieldtype": "Check", + "fieldname": "posa_delivery_charges", + "fieldtype": "Link", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -1086,18 +1106,18 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_allow_change_posting_date", + "insert_after": "is_shipping_address", "is_system_generated": 0, "is_virtual": 0, - "label": "Default Card View", + "label": "Delivery Charges", "length": 0, "mandatory_depends_on": null, - "modified": "2023-03-12 14:03:44.088542", + "modified": "2022-07-24 17:20:00.246026", "module": null, - "name": "POS Profile-posa_default_card_view", + "name": "Address-posa_delivery_charges", "no_copy": 0, "non_negative": 0, - "options": null, + "options": "Delivery Charges", "permlevel": 0, "precision": "", "print_hide": 0, @@ -1108,6 +1128,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1161,6 +1182,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1214,6 +1236,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1267,6 +1290,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1320,6 +1344,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1373,6 +1398,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1426,6 +1452,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1479,6 +1506,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1532,6 +1560,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1585,6 +1614,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1638,6 +1668,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1691,6 +1722,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1744,6 +1776,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1797,6 +1830,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1850,6 +1884,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1903,6 +1938,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -1956,6 +1992,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2009,6 +2046,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2062,6 +2100,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2115,6 +2154,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2168,6 +2208,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2221,6 +2262,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2274,6 +2316,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 1, "unique": 0, "width": null @@ -2327,6 +2370,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2380,6 +2424,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2433,6 +2478,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2449,11 +2495,11 @@ "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Customer", + "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_birthday", - "fieldtype": "Date", + "fieldname": "posa_fetch_coupon", + "fieldtype": "Check", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2464,15 +2510,15 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "contact_html", + "insert_after": "posa_hide_variants_items", "is_system_generated": 0, "is_virtual": 0, - "label": "Birthday", + "label": "Auto Fetch Coupon Gifts", "length": 0, "mandatory_depends_on": null, - "modified": "2021-07-31 00:12:09.417519", + "modified": "2021-07-29 22:58:10.372543", "module": null, - "name": "Customer-posa_birthday", + "name": "POS Profile-posa_fetch_coupon", "no_copy": 0, "non_negative": 0, "options": null, @@ -2486,6 +2532,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2498,15 +2545,15 @@ "collapsible_depends_on": null, "columns": 0, "default": null, - "depends_on": null, + "depends_on": "posa_auto_referral", "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "POS Profile", + "dt": "Company", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_fetch_coupon", - "fieldtype": "Check", + "fieldname": "posa_primary_offer", + "fieldtype": "Link", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2517,18 +2564,18 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_hide_variants_items", + "insert_after": "posa_customer_offer", "is_system_generated": 0, "is_virtual": 0, - "label": "Auto Fetch Coupon Gifts", + "label": "Primary Customer Offer", "length": 0, "mandatory_depends_on": null, - "modified": "2021-07-29 22:58:10.372543", + "modified": "2021-07-29 23:11:05.290809", "module": null, - "name": "POS Profile-posa_fetch_coupon", + "name": "Company-posa_primary_offer", "no_copy": 0, "non_negative": 0, - "options": null, + "options": "POS Offer", "permlevel": 0, "precision": "", "print_hide": 0, @@ -2539,6 +2586,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2550,16 +2598,16 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": null, - "depends_on": "posa_auto_referral", + "default": "0", + "depends_on": null, "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Company", + "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_primary_offer", - "fieldtype": "Link", + "fieldname": "posa_allow_customer_purchase_order", + "fieldtype": "Check", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2570,18 +2618,18 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_customer_offer", + "insert_after": "posa_fetch_coupon", "is_system_generated": 0, "is_virtual": 0, - "label": "Primary Customer Offer", + "label": "Allow Customer Purchase Order", "length": 0, "mandatory_depends_on": null, - "modified": "2021-07-29 23:11:05.290809", + "modified": "2021-12-16 16:27:32.300240", "module": null, - "name": "Company-posa_primary_offer", + "name": "POS Profile-posa_allow_customer_purchase_order", "no_copy": 0, "non_negative": 0, - "options": "POS Offer", + "options": null, "permlevel": 0, "precision": "", "print_hide": 0, @@ -2592,6 +2640,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2600,7 +2649,7 @@ "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, - "collapsible": 1, + "collapsible": 0, "collapsible_depends_on": null, "columns": 0, "default": null, @@ -2611,8 +2660,8 @@ "dt": "Customer", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_referral_section", - "fieldtype": "Section Break", + "fieldname": "posa_birthday", + "fieldtype": "Date", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2623,15 +2672,15 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_birthday", + "insert_after": "contact_html", "is_system_generated": 0, "is_virtual": 0, - "label": "Referral Code", + "label": "Birthday", "length": 0, "mandatory_depends_on": null, - "modified": "2021-07-29 23:23:04.910503", + "modified": "2021-07-31 00:12:09.417519", "module": null, - "name": "Customer-posa_referral_section", + "name": "Customer-posa_birthday", "no_copy": 0, "non_negative": 0, "options": null, @@ -2645,6 +2694,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2656,16 +2706,16 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": "0", - "depends_on": null, + "default": "", + "depends_on": "posa_auto_referral", "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "POS Profile", + "dt": "Company", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_allow_customer_purchase_order", - "fieldtype": "Check", + "fieldname": "posa_referral_campaign", + "fieldtype": "Link", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2676,18 +2726,18 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_fetch_coupon", + "insert_after": "posa_primary_offer", "is_system_generated": 0, "is_virtual": 0, - "label": "Allow Customer Purchase Order", + "label": "Referral Campaign", "length": 0, "mandatory_depends_on": null, - "modified": "2021-12-16 16:27:32.300240", + "modified": "2021-07-29 23:11:05.723688", "module": null, - "name": "POS Profile-posa_allow_customer_purchase_order", + "name": "Company-posa_referral_campaign", "no_copy": 0, "non_negative": 0, - "options": null, + "options": "Campaign", "permlevel": 0, "precision": "", "print_hide": 0, @@ -2698,6 +2748,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2709,16 +2760,16 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": "", - "depends_on": "posa_auto_referral", + "default": "0", + "depends_on": null, "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Company", + "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_referral_campaign", - "fieldtype": "Link", + "fieldname": "posa_allow_print_last_invoice", + "fieldtype": "Check", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2729,18 +2780,18 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_primary_offer", + "insert_after": "posa_allow_customer_purchase_order", "is_system_generated": 0, "is_virtual": 0, - "label": "Referral Campaign", + "label": "Allow Print Last Invoice", "length": 0, "mandatory_depends_on": null, - "modified": "2021-07-29 23:11:05.723688", + "modified": "2021-12-16 18:00:40.631156", "module": null, - "name": "Company-posa_referral_campaign", + "name": "POS Profile-posa_allow_print_last_invoice", "no_copy": 0, "non_negative": 0, - "options": "Campaign", + "options": null, "permlevel": 0, "precision": "", "print_hide": 0, @@ -2751,15 +2802,16 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null }, { - "allow_in_quick_entry": 1, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, - "collapsible": 0, + "collapsible": 1, "collapsible_depends_on": null, "columns": 0, "default": null, @@ -2770,8 +2822,8 @@ "dt": "Customer", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_referral_code", - "fieldtype": "Data", + "fieldname": "posa_referral_section", + "fieldtype": "Section Break", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2782,16 +2834,16 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_referral_section", + "insert_after": "posa_birthday", "is_system_generated": 0, "is_virtual": 0, "label": "Referral Code", "length": 0, "mandatory_depends_on": null, - "modified": "2021-07-29 22:42:57.772021", + "modified": "2021-07-29 23:23:04.910503", "module": null, - "name": "Customer-posa_referral_code", - "no_copy": 1, + "name": "Customer-posa_referral_section", + "no_copy": 0, "non_negative": 0, "options": null, "permlevel": 0, @@ -2804,7 +2856,8 @@ "report_hide": 0, "reqd": 0, "search_index": 0, - "translatable": 1, + "sort_options": 0, + "translatable": 0, "unique": 0, "width": null }, @@ -2815,7 +2868,7 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": "0", + "default": null, "depends_on": null, "description": null, "docstatus": 0, @@ -2823,7 +2876,7 @@ "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_allow_print_last_invoice", + "fieldname": "posa_display_additional_notes", "fieldtype": "Check", "hidden": 0, "hide_border": 0, @@ -2835,15 +2888,15 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_allow_customer_purchase_order", + "insert_after": "posa_allow_print_last_invoice", "is_system_generated": 0, "is_virtual": 0, - "label": "Allow Print Last Invoice", + "label": "Display Additional Notes", "length": 0, "mandatory_depends_on": null, - "modified": "2021-12-16 18:00:40.631156", + "modified": "2021-12-19 16:54:32.986600", "module": null, - "name": "POS Profile-posa_allow_print_last_invoice", + "name": "POS Profile-posa_display_additional_notes", "no_copy": 0, "non_negative": 0, "options": null, @@ -2857,6 +2910,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2864,7 +2918,7 @@ { "allow_in_quick_entry": 1, "allow_on_submit": 0, - "bold": 1, + "bold": 0, "collapsible": 0, "collapsible_depends_on": null, "columns": 0, @@ -2876,8 +2930,8 @@ "dt": "Customer", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_referral_company", - "fieldtype": "Link", + "fieldname": "posa_referral_code", + "fieldtype": "Data", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2888,18 +2942,18 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_referral_code", + "insert_after": "posa_referral_section", "is_system_generated": 0, "is_virtual": 0, - "label": "Referral Company", + "label": "Referral Code", "length": 0, "mandatory_depends_on": null, - "modified": "2021-07-29 23:24:11.207034", + "modified": "2021-07-29 22:42:57.772021", "module": null, - "name": "Customer-posa_referral_company", + "name": "Customer-posa_referral_code", "no_copy": 1, "non_negative": 0, - "options": "Company", + "options": null, "permlevel": 0, "precision": "", "print_hide": 0, @@ -2910,7 +2964,8 @@ "report_hide": 0, "reqd": 0, "search_index": 0, - "translatable": 0, + "sort_options": 0, + "translatable": 1, "unique": 0, "width": null }, @@ -2929,7 +2984,7 @@ "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_display_additional_notes", + "fieldname": "posa_allow_write_off_change", "fieldtype": "Check", "hidden": 0, "hide_border": 0, @@ -2941,15 +2996,15 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_allow_print_last_invoice", + "insert_after": "posa_display_additional_notes", "is_system_generated": 0, "is_virtual": 0, - "label": "Display Additional Notes", + "label": "Allow Write Off Change", "length": 0, "mandatory_depends_on": null, - "modified": "2021-12-19 16:54:32.986600", + "modified": "2022-02-12 04:26:04.003374", "module": null, - "name": "POS Profile-posa_display_additional_notes", + "name": "POS Profile-posa_allow_write_off_change", "no_copy": 0, "non_negative": 0, "options": null, @@ -2963,6 +3018,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -2979,11 +3035,11 @@ "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "POS Profile", + "dt": "Sales Invoice Item", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_allow_write_off_change", - "fieldtype": "Check", + "fieldname": "posa_offers", + "fieldtype": "Small Text", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2994,15 +3050,15 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_display_additional_notes", + "insert_after": "pricing_rules", "is_system_generated": 0, "is_virtual": 0, - "label": "Allow Write Off Change", + "label": "POS Offers", "length": 0, "mandatory_depends_on": null, - "modified": "2022-02-12 04:26:04.003374", + "modified": "2021-06-07 01:51:16.390447", "module": null, - "name": "POS Profile-posa_allow_write_off_change", + "name": "Sales Invoice Item-posa_offers", "no_copy": 0, "non_negative": 0, "options": null, @@ -3011,19 +3067,20 @@ "print_hide": 0, "print_hide_if_no_value": 0, "print_width": null, - "read_only": 0, + "read_only": 1, "read_only_depends_on": null, "report_hide": 0, "reqd": 0, "search_index": 0, - "translatable": 0, + "sort_options": 0, + "translatable": 1, "unique": 0, "width": null }, { - "allow_in_quick_entry": 0, + "allow_in_quick_entry": 1, "allow_on_submit": 0, - "bold": 0, + "bold": 1, "collapsible": 0, "collapsible_depends_on": null, "columns": 0, @@ -3032,11 +3089,11 @@ "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Sales Invoice Item", + "dt": "Customer", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_offers", - "fieldtype": "Small Text", + "fieldname": "posa_referral_company", + "fieldtype": "Link", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -3047,29 +3104,30 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "pricing_rules", + "insert_after": "posa_referral_code", "is_system_generated": 0, "is_virtual": 0, - "label": "POS Offers", + "label": "Referral Company", "length": 0, "mandatory_depends_on": null, - "modified": "2021-06-07 01:51:16.390447", + "modified": "2021-07-29 23:24:11.207034", "module": null, - "name": "Sales Invoice Item-posa_offers", - "no_copy": 0, + "name": "Customer-posa_referral_company", + "no_copy": 1, "non_negative": 0, - "options": null, + "options": "Company", "permlevel": 0, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, "print_width": null, - "read_only": 1, + "read_only": 0, "read_only_depends_on": null, "report_hide": 0, "reqd": 0, "search_index": 0, - "translatable": 1, + "sort_options": 0, + "translatable": 0, "unique": 0, "width": null }, @@ -3122,6 +3180,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3175,6 +3234,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3228,6 +3288,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3281,6 +3342,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3334,6 +3396,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3387,6 +3450,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 1, "unique": 0, "width": null @@ -3440,6 +3504,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3493,6 +3558,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3546,6 +3612,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3599,6 +3666,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3652,6 +3720,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3705,6 +3774,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3758,6 +3828,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3811,6 +3882,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3864,6 +3936,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3917,6 +3990,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -3970,6 +4044,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4023,6 +4098,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4076,6 +4152,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4129,6 +4206,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4182,6 +4260,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4235,6 +4314,223 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": "0", + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "POS Profile", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "posa_use_attribute_filter_one", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "posa_tax_inclusive", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Use Attribute Filter One", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-09-13 02:08:33.728049", + "module": null, + "name": "POS Profile-posa_use_attribute_filter_one", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "posa_use_attribute_filter_one", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "POS Profile", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "posa_attribute_filter_one", + "fieldtype": "Link", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "posa_use_attribute_filter_one", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Attribute Filter One", + "length": 0, + "mandatory_depends_on": "posa_use_attribute_filter_one", + "modified": "2023-09-13 02:08:33.999824", + "module": null, + "name": "POS Profile-posa_attribute_filter_one", + "no_copy": 0, + "non_negative": 0, + "options": "Item Attribute", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": "0", + "depends_on": "", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "POS Profile", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "posa_use_attribute_filter_two", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "posa_attribute_filter_one", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Use Attribute Filter Two", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-09-13 02:08:34.197899", + "module": null, + "name": "POS Profile-posa_use_attribute_filter_two", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "posa_use_attribute_filter_two", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "POS Profile", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "posa_attribute_filter_two", + "fieldtype": "Link", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "posa_use_attribute_filter_two", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Attribute Filter Two", + "length": 0, + "mandatory_depends_on": "posa_use_attribute_filter_two", + "modified": "2023-09-13 02:08:34.408419", + "module": null, + "name": "POS Profile-posa_attribute_filter_two", + "no_copy": 0, + "non_negative": 0, + "options": "Item Attribute", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4266,7 +4562,7 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_tax_inclusive", + "insert_after": "posa_attribute_filter_two", "is_system_generated": 0, "is_virtual": 0, "label": null, @@ -4288,6 +4584,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4341,6 +4638,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4394,6 +4692,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4447,6 +4746,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4500,6 +4800,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4512,14 +4813,14 @@ "collapsible_depends_on": null, "columns": 0, "default": null, - "depends_on": null, + "depends_on": "", "description": "Use Search Limit for Items", "docstatus": 0, "doctype": "Custom Field", "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "pose_use_limit_search", + "fieldname": "posa_use_limit_search", "fieldtype": "Check", "hidden": 0, "hide_border": 0, @@ -4536,10 +4837,10 @@ "is_virtual": 0, "label": "Use Limit Search", "length": 0, - "mandatory_depends_on": null, + "mandatory_depends_on": "", "modified": "2023-06-05 16:59:18.429778", "module": null, - "name": "POS Profile-pose_use_limit_search", + "name": "POS Profile-posa_use_limit_search", "no_copy": 0, "non_negative": 0, "options": null, @@ -4553,6 +4854,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4565,7 +4867,7 @@ "collapsible_depends_on": null, "columns": 0, "default": "500", - "depends_on": "pose_use_limit_search", + "depends_on": "posa_use_limit_search", "description": "Search Limit for Items\nFor best performance keep this under 1500", "docstatus": 0, "doctype": "Custom Field", @@ -4584,12 +4886,12 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "pose_use_limit_search", + "insert_after": "posa_use_limit_search", "is_system_generated": 0, "is_virtual": 0, "label": "Search Limit Number", "length": 0, - "mandatory_depends_on": "pose_use_limit_search", + "mandatory_depends_on": "posa_use_limit_search", "modified": "2023-06-05 16:59:18.717131", "module": null, "name": "POS Profile-posa_search_limit", @@ -4606,6 +4908,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4659,6 +4962,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4712,6 +5016,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4765,6 +5070,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4818,6 +5124,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4871,6 +5178,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -4924,6 +5232,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 1, "unique": 0, "width": null @@ -4977,6 +5286,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null @@ -5030,6 +5340,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, + "sort_options": 0, "translatable": 0, "unique": 0, "width": null diff --git a/posawesome/hooks.py b/posawesome/hooks.py index 2bf447ce2..ef3bfa328 100644 --- a/posawesome/hooks.py +++ b/posawesome/hooks.py @@ -245,7 +245,7 @@ "POS Profile-posa_server_cache_duration", "POS Profile-posa_allow_duplicate_customer_names", "POS Profile-column_break_anyol", - "POS Profile-pose_use_limit_search", + "POS Profile-posa_use_limit_search", "POS Profile-posa_search_limit", "POS Profile-posa_search_batch_no", "POS Profile-pos_awesome_payments", @@ -254,6 +254,10 @@ "POS Profile-posa_allow_reconcile_payments", "POS Profile-column_break_uolvm", "POS Profile-posa_allow_mpesa_reconcile_payments", + "POS Profile-posa_use_attribute_filter_one", + "POS Profile-posa_attribute_filter_one", + "POS Profile-posa_use_attribute_filter_two", + "POS Profile-posa_attribute_filter_two", ), ] ], diff --git a/posawesome/posawesome/api/posapp.py b/posawesome/posawesome/api/posapp.py index 07b9b834b..aab0bcd08 100644 --- a/posawesome/posawesome/api/posapp.py +++ b/posawesome/posawesome/api/posapp.py @@ -126,17 +126,17 @@ def update_opening_shift_data(data, pos_profile): @frappe.whitelist() -def get_items(pos_profile, price_list=None, item_group="", search_value=""): +def get_items(pos_profile, price_list=None, item_group="", search_value="", attribute_one = "", attribute_two = ""): _pos_profile = json.loads(pos_profile) ttl = _pos_profile.get("posa_server_cache_duration") if ttl: ttl = int(ttl) * 30 @redis_cache(ttl=ttl or 1800) - def __get_items(pos_profile, price_list, item_group, search_value): - return _get_items(pos_profile, price_list, item_group, search_value) + def __get_items(pos_profile, price_list, item_group, search_value, attribute_one = "", attribute_two = ""): + return _get_items(pos_profile, price_list, item_group, search_value, attribute_one, attribute_two) - def _get_items(pos_profile, price_list, item_group, search_value): + def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, attribute_two): pos_profile = json.loads(pos_profile) today = nowdate() data = dict() @@ -145,15 +145,23 @@ def _get_items(pos_profile, price_list, item_group, search_value): search_batch_no = pos_profile.get("posa_search_batch_no") posa_show_template_items = pos_profile.get("posa_show_template_items") warehouse = pos_profile.get("warehouse") - use_limit_search = pos_profile.get("pose_use_limit_search") + use_limit_search = pos_profile.get("posa_use_limit_search") search_limit = 0 if not price_list: price_list = pos_profile.get("selling_price_list") limit = "" - condition = "" + + if pos_profile.get("posa_use_attribute_filter_one"): + condition += " AND b.attribute = '{attribute_name}'".format( + attribute_name=pos_profile.get("posa_attribute_filter_one") + ) + if pos_profile.get("posa_use_attribute_filter_two"): + condition += " AND c.attribute = '{attribute_name}'".format( + attribute_name=pos_profile.get("posa_attribute_filter_two") + ) condition += get_item_group_condition(pos_profile.get("name")) if use_limit_search: @@ -171,49 +179,56 @@ def _get_items(pos_profile, price_list, item_group, search_value): condition += get_seearch_items_conditions( item_code, serial_no, batch_no, barcode ) + if(attribute_one): + condition += """ AND b.attribute_value like '%{attribute_one}%' + """.format(attribute_one=attribute_one) + if(attribute_two): + condition += """ AND c.attribute_value like '%{attribute_two}%' + """.format(attribute_two=attribute_two) if item_group: - condition += " AND item_group like '%{item_group}%'".format( + condition += " AND i.item_group like '%{item_group}%'".format( item_group=item_group ) limit = " LIMIT {search_limit}".format(search_limit=search_limit) if not posa_show_template_items: - condition += " AND has_variants = 0" + condition += " AND i.has_variants = 0" result = [] - - items_data = frappe.db.sql( - """ + items_data = frappe.db.sql(""" SELECT - name AS item_code, - item_name, - description, - stock_uom, - image, - is_stock_item, - has_variants, - variant_of, - item_group, - idx as idx, - has_batch_no, - has_serial_no, - max_discount, - brand + i.name AS item_code, + i.item_name, + i.description, + i.stock_uom, + i.image, + i.is_stock_item, + i.has_variants, + i.variant_of, + i.item_group, + i.idx as idx, + i.has_batch_no, + i.has_serial_no, + i.max_discount, + i.brand, + b.attribute_value as attribute_one, + c.attribute_value as attribute_two FROM - `tabItem` + `tabItem` i , `tabItem Variant Attribute` b , `tabItem Variant Attribute` c WHERE - disabled = 0 - AND is_sales_item = 1 - AND is_fixed_asset = 0 - {condition} - ORDER BY - item_name asc + i.disabled = 0 + AND i.is_sales_item = 1 + AND i.is_fixed_asset = 0 + AND i.item_code = b.parent + AND i.item_code = c.parent + {condition} + Group BY i.item_code + ORDER BY + i.item_name asc {limit} """.format( condition=condition, limit=limit - ), - as_dict=1, - ) + ), as_dict=1,) if items_data: items = [d.item_code for d in items_data] @@ -325,16 +340,16 @@ def _get_items(pos_profile, price_list, item_group, search_value): return result if _pos_profile.get("posa_use_server_cache"): - return __get_items(pos_profile, price_list, item_group, search_value) + return __get_items(pos_profile, price_list, item_group, search_value, attribute_one, attribute_two) else: - return _get_items(pos_profile, price_list, item_group, search_value) + return _get_items(pos_profile, price_list, item_group, search_value, attribute_one, attribute_two) def get_item_group_condition(pos_profile): cond = " and 1=1" item_groups = get_item_groups(pos_profile) if item_groups: - cond = " and item_group in (%s)" % (", ".join(["%s"] * len(item_groups))) + cond = " and i.item_group in (%s)" % (", ".join(["%s"] * len(item_groups))) return cond % tuple(item_groups) @@ -1741,7 +1756,28 @@ def search_serial_or_batch_or_barcode_number(search_value, search_serial_no): def get_seearch_items_conditions(item_code, serial_no, batch_no, barcode): if serial_no or batch_no or barcode: - return " and name = {0}".format(frappe.db.escape(item_code)) - return """ and (name like {item_code} or item_name like {item_code})""".format( + return " and i.name = {0}".format(frappe.db.escape(item_code)) + return """ and (i.name like {item_code} or i.item_name like {item_code})""".format( item_code=frappe.db.escape("%" + item_code + "%") ) + + +@frappe.whitelist() +def get_attributes_values(pos_profile): + _pos_profile = json.loads(pos_profile) + values_one = None + values_two = None + + if _pos_profile.get("posa_use_attribute_filter_one"): + values_one = frappe.db.get_all("Item Attribute Value", + filters={'parent':_pos_profile.get("posa_attribute_filter_one")}, + fields=['attribute_value'], + order_by="attribute_value") + + if _pos_profile.get("posa_use_attribute_filter_two"): + values_two = frappe.db.get_all("Item Attribute Value", + filters={'parent':_pos_profile.get("posa_attribute_filter_two")}, + fields=['attribute_value'], + order_by="attribute_value") + + return {"values_one":values_one,"values_two":values_two} \ No newline at end of file diff --git a/posawesome/public/js/posapp/components/pos/ItemsSelector.vue b/posawesome/public/js/posapp/components/pos/ItemsSelector.vue index 9a35104ac..45f436fea 100644 --- a/posawesome/public/js/posapp/components/pos/ItemsSelector.vue +++ b/posawesome/public/js/posapp/components/pos/ItemsSelector.vue @@ -2,7 +2,7 @@