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 @@
- + - + - + + + + + + + + + + + + + +
@@ -126,18 +149,7 @@ - - - - + { + vm.attributes_one.push(element.attribute_value); + }); + + } + if (r.message.values_two) { + r.message.values_two.forEach((element) => { + vm.attributes_two.push(element.attribute_value); + }); + + } + }, + }); + }, getItmesHeaders() { const items_headers = [ { @@ -395,7 +447,7 @@ export default { }, search_onchange() { const vm = this; - if (vm.pos_profile.pose_use_limit_search) { + if (vm.pos_profile.posa_use_limit_search) { vm.get_items(); } else { vm.enter_event(); @@ -501,18 +553,30 @@ export default { computed: { filtred_items() { this.search = this.get_search(this.first_search); - if (!this.pos_profile.pose_use_limit_search) { + if (!this.pos_profile.posa_use_limit_search) { let filtred_list = []; let filtred_group_list = []; - if (this.item_group != 'ALL') { - filtred_group_list = this.items.filter((item) => - item.item_group - .toLowerCase() - .includes(this.item_group.toLowerCase()) - ); - } else { - filtred_group_list = this.items; + + let gr = ""; + let afo = ""; + let aft = ""; + + if(this.item_group != 'ALL'){ + gr = this.item_group.toLowerCase(); + } + if(this.attribute_one != 'ALL'){ + afo = this.attribute_one.toLowerCase(); } + if(this.attribute_two != 'ALL'){ + aft = this.attribute_two.toLowerCase(); + } + + filtred_group_list = this.items.filter((item) => + item.item_group.toLowerCase().includes(gr) && + item.attribute_one.toLowerCase().includes(afo) && + item.attribute_two.toLowerCase().includes(aft) + ); + if (!this.search || this.search.length < 3) { if ( this.pos_profile.posa_show_template_items && @@ -608,6 +672,7 @@ export default { this.pos_profile = data.pos_profile; this.get_items(); this.get_items_groups(); + this.get_attributes_values(); this.items_view = this.pos_profile.posa_default_card_view ? 'card' : 'list'; From 625071c225df839a72b29b46197c8cd4f0badaa3 Mon Sep 17 00:00:00 2001 From: Madcheese101 <40042269+Madcheese101@users.noreply.github.com> Date: Sat, 16 Sep 2023 04:18:40 +0200 Subject: [PATCH 2/4] Fixed: filtering and attribute field not populating - new attribute filtering fields from previous commit now use the item_attributes field instead on columns from SQL statement while not using the use_limit_search field. - fixed an issue where the condition for fetching variant item attributes was incorrect. --- posawesome/posawesome/api/posapp.py | 46 +++++++++---------- .../posapp/components/pos/ItemsSelector.vue | 11 ++--- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/posawesome/posawesome/api/posapp.py b/posawesome/posawesome/api/posapp.py index aab0bcd08..d4a8ef1b5 100644 --- a/posawesome/posawesome/api/posapp.py +++ b/posawesome/posawesome/api/posapp.py @@ -153,15 +153,7 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, 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") - ) + sql_join = "" condition += get_item_group_condition(pos_profile.get("name")) if use_limit_search: @@ -179,12 +171,21 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, 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(attribute_one and pos_profile.get("posa_use_attribute_filter_one")): + sql_join += " , `tabItem Variant Attribute` b" + condition += """ + AND i.item_code = b.parent + AND b.attribute_value like '%{attribute_one}%' + AND b.attribute = '{attribute_name}' + """.format(attribute_one=attribute_one, + attribute_name=pos_profile.get("posa_attribute_filter_one")) + if(attribute_two and pos_profile.get("posa_use_attribute_filter_two")): + sql_join += " , `tabItem Variant Attribute` c" + condition += """ AND i.item_code = c.parent + AND c.attribute_value like '%{attribute_two}%' + AND c.attribute = '{attribute_name}' + """.format(attribute_two=attribute_two, + attribute_name=pos_profile.get("posa_attribute_filter_two")) if item_group: condition += " AND i.item_group like '%{item_group}%'".format( item_group=item_group @@ -210,24 +211,20 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, 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 + i.brand FROM - `tabItem` i , `tabItem Variant Attribute` b , `tabItem Variant Attribute` c + `tabItem` i {sql_join} WHERE 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 + condition=condition, limit=limit, sql_join=sql_join ), as_dict=1,) if items_data: @@ -310,11 +307,12 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, if pos_profile.get("posa_show_template_items") and item.has_variants: attributes = get_item_attributes(item.item_code) item_attributes = "" - if pos_profile.get("posa_show_template_items") and item.variant_of: + if item.variant_of: item_attributes = frappe.get_all( "Item Variant Attribute", - fields=["attribute", "attribute_value"], + fields=["attribute_value"], filters={"parent": item.item_code, "parentfield": "attributes"}, + pluck="attribute_value" ) if posa_display_items_in_stock and ( not item_stock_qty or item_stock_qty < 0 diff --git a/posawesome/public/js/posapp/components/pos/ItemsSelector.vue b/posawesome/public/js/posapp/components/pos/ItemsSelector.vue index 45f436fea..025495537 100644 --- a/posawesome/public/js/posapp/components/pos/ItemsSelector.vue +++ b/posawesome/public/js/posapp/components/pos/ItemsSelector.vue @@ -560,23 +560,22 @@ export default { let gr = ""; let afo = ""; let aft = ""; - + if(this.item_group != 'ALL'){ gr = this.item_group.toLowerCase(); } if(this.attribute_one != 'ALL'){ - afo = this.attribute_one.toLowerCase(); + afo = this.attribute_one; } if(this.attribute_two != 'ALL'){ - aft = this.attribute_two.toLowerCase(); + aft = this.attribute_two; } filtred_group_list = this.items.filter((item) => item.item_group.toLowerCase().includes(gr) && - item.attribute_one.toLowerCase().includes(afo) && - item.attribute_two.toLowerCase().includes(aft) + (afo ? item.item_attributes.includes(afo) : true) && + (aft ? item.item_attributes.includes(aft) : true) ); - if (!this.search || this.search.length < 3) { if ( this.pos_profile.posa_show_template_items && From ee44017a1797a037a761f442c3a57282215e5e86 Mon Sep 17 00:00:00 2001 From: Madcheese101 <40042269+Madcheese101@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:01:44 +0200 Subject: [PATCH 3/4] changed from frappe.db.sql to frappe.qb changed from frappe.db.sql (method to get items_data) to frappe.qb for more security and to follow the new direction to push for frappe.qb instead if frappe.db.sql --- posawesome/posawesome/api/posapp.py | 151 +++++++++++++--------------- 1 file changed, 70 insertions(+), 81 deletions(-) diff --git a/posawesome/posawesome/api/posapp.py b/posawesome/posawesome/api/posapp.py index d4a8ef1b5..a9d50a767 100644 --- a/posawesome/posawesome/api/posapp.py +++ b/posawesome/posawesome/api/posapp.py @@ -140,22 +140,43 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, pos_profile = json.loads(pos_profile) today = nowdate() data = dict() - posa_display_items_in_stock = pos_profile.get("posa_display_items_in_stock") search_serial_no = pos_profile.get("posa_search_serial_no") search_batch_no = pos_profile.get("posa_search_batch_no") posa_show_template_items = pos_profile.get("posa_show_template_items") + posa_hide_variants_items = pos_profile.get("posa_hide_variants_items") warehouse = pos_profile.get("warehouse") use_limit_search = pos_profile.get("posa_use_limit_search") + hide_unavailable_items = pos_profile.get("posa_display_items_in_stock") search_limit = 0 if not price_list: price_list = pos_profile.get("selling_price_list") - - limit = "" - condition = "" - sql_join = "" - condition += get_item_group_condition(pos_profile.get("name")) - + allowed_item_groups = get_item_groups(pos_profile.get("name")) + item_doc = frappe.qb.DocType("Item") + + items_data_qb = (frappe.qb + .from_(item_doc) + .select(item_doc.name.as_("item_code"), + item_doc.item_name, + item_doc.description, + item_doc.stock_uom, + item_doc.image, + item_doc.is_stock_item, + item_doc.has_variants, + item_doc.variant_of, + item_doc.item_group, + item_doc.idx, + item_doc.has_batch_no, + item_doc.has_serial_no, + item_doc.max_discount, + item_doc.brand) + .where(item_doc.disabled == 0) + .where(item_doc.is_fixed_asset == 0) + .where(item_doc.is_sales_item == 1) + .groupby(item_doc.item_code) + .orderby(item_doc.item_name) + ) + if use_limit_search: search_limit = pos_profile.get("posa_search_limit") or 500 if search_value: @@ -168,64 +189,49 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, batch_no = data.get("batch_no") if data.get("batch_no") else "" barcode = data.get("barcode") if data.get("barcode") else "" - condition += get_seearch_items_conditions( - item_code, serial_no, batch_no, barcode - ) + if serial_no or batch_no or barcode: + items_data_qb = items_data_qb.where(item_doc.name == frappe.db.escape(item_code)) + elif item_code: + like_state = ("%"+ item_code +"%") + items_data_qb = items_data_qb.where( + item_doc.name.like(like_state) | item_doc.item_name.like(like_state) + ) if(attribute_one and pos_profile.get("posa_use_attribute_filter_one")): - sql_join += " , `tabItem Variant Attribute` b" - condition += """ - AND i.item_code = b.parent - AND b.attribute_value like '%{attribute_one}%' - AND b.attribute = '{attribute_name}' - """.format(attribute_one=attribute_one, - attribute_name=pos_profile.get("posa_attribute_filter_one")) + attribute_one_doc = frappe.qb.DocType("Item Variant Attribute").as_("b") + items_data_qb = items_data_qb.from_(attribute_one_doc) + items_data_qb = items_data_qb.where( + item_doc.name == attribute_one_doc.parent) + items_data_qb = items_data_qb.where( + attribute_one_doc.attribute == pos_profile.get("posa_attribute_filter_one")) + items_data_qb = items_data_qb.where( + attribute_one_doc.attribute_value.like("%"+attribute_one+"%") + ) + if(attribute_two and pos_profile.get("posa_use_attribute_filter_two")): - sql_join += " , `tabItem Variant Attribute` c" - condition += """ AND i.item_code = c.parent - AND c.attribute_value like '%{attribute_two}%' - AND c.attribute = '{attribute_name}' - """.format(attribute_two=attribute_two, - attribute_name=pos_profile.get("posa_attribute_filter_two")) - if item_group: - condition += " AND i.item_group like '%{item_group}%'".format( - item_group=item_group + attribute_two_doc = frappe.qb.DocType("Item Variant Attribute").as_("c") + + items_data_qb = items_data_qb.from_(attribute_two_doc) + items_data_qb = items_data_qb.where( + item_doc.name == attribute_two_doc.parent) + items_data_qb = items_data_qb.where( + attribute_two_doc.attribute == pos_profile.get("posa_attribute_filter_two")) + items_data_qb = items_data_qb.where( + attribute_two_doc.attribute_value.like("%"+attribute_two+"%") ) - limit = " LIMIT {search_limit}".format(search_limit=search_limit) - - if not posa_show_template_items: - condition += " AND i.has_variants = 0" + + if item_group: + items_data_qb = items_data_qb.where(item_doc.item_group.like("%"+item_group+"%")) + items_data_qb = items_data_qb.limit(search_limit) + if allowed_item_groups: + items_data_qb = items_data_qb.where(item_doc.item_group.isin(allowed_item_groups)) + + if posa_hide_variants_items and posa_show_template_items: + items_data_qb = items_data_qb.where(item_doc.has_variants == 1) + if not posa_show_template_items and posa_hide_variants_items: + items_data_qb = items_data_qb.where(item_doc.has_variants == 0) result = [] - items_data = frappe.db.sql(""" - SELECT - 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 - FROM - `tabItem` i {sql_join} - WHERE - i.disabled = 0 - AND i.is_sales_item = 1 - AND i.is_fixed_asset = 0 - {condition} - Group BY i.item_code - ORDER BY - i.item_name asc - {limit} - """.format( - condition=condition, limit=limit, sql_join=sql_join - ), as_dict=1,) + items_data = items_data_qb.run(as_dict=1) if items_data: items = [d.item_code for d in items_data] @@ -299,12 +305,12 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, fields=["name as serial_no"], ) item_stock_qty = 0 - if pos_profile.get("posa_display_items_in_stock") or use_limit_search: + if hide_unavailable_items or use_limit_search: item_stock_qty = get_stock_availability( item_code, pos_profile.get("warehouse") ) attributes = "" - if pos_profile.get("posa_show_template_items") and item.has_variants: + if posa_show_template_items and item.has_variants: attributes = get_item_attributes(item.item_code) item_attributes = "" if item.variant_of: @@ -314,7 +320,7 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, filters={"parent": item.item_code, "parentfield": "attributes"}, pluck="attribute_value" ) - if posa_display_items_in_stock and ( + if hide_unavailable_items and ( not item_stock_qty or item_stock_qty < 0 ): pass @@ -335,6 +341,7 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, } ) result.append(row) + return result if _pos_profile.get("posa_use_server_cache"): @@ -343,15 +350,6 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, 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 i.item_group in (%s)" % (", ".join(["%s"] * len(item_groups))) - - return cond % tuple(item_groups) - - def get_root_of(doctype): """Get root element of a DocType with a tree structure""" result = frappe.db.sql( @@ -1751,15 +1749,6 @@ def search_serial_or_batch_or_barcode_number(search_value, search_serial_no): return batch_no_data return {} - -def get_seearch_items_conditions(item_code, serial_no, batch_no, barcode): - if serial_no or batch_no or barcode: - 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) From 6c11794e2a81710ee253d05860452ac0fc4bb2b9 Mon Sep 17 00:00:00 2001 From: Madcheese101 <40042269+Madcheese101@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:33:24 +0200 Subject: [PATCH 4/4] changed the hide_unavailable_items logic to work on DB directly Changed filtering items depending on if they have stock or not through the option (hide unavailable items) in POS profile to be applied as a condition while fetching the data from the database instead of looping through the db result and then filtering. this results in a better performance when the (Hide Unavailable Items) is enabled. --- posawesome/posawesome/api/posapp.py | 45 +++++++++++++++-------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/posawesome/posawesome/api/posapp.py b/posawesome/posawesome/api/posapp.py index a9d50a767..23deaaa2e 100644 --- a/posawesome/posawesome/api/posapp.py +++ b/posawesome/posawesome/api/posapp.py @@ -230,6 +230,13 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, items_data_qb = items_data_qb.where(item_doc.has_variants == 1) if not posa_show_template_items and posa_hide_variants_items: items_data_qb = items_data_qb.where(item_doc.has_variants == 0) + if hide_unavailable_items: + bin_doc = frappe.qb.DocType("Bin").as_("bin") + items_data_qb = items_data_qb.from_(bin_doc) + items_data_qb = items_data_qb.where(bin_doc.warehouse == warehouse) + items_data_qb = items_data_qb.where(bin_doc.item_code == item_doc.name) + items_data_qb = items_data_qb.where(bin_doc.actual_qty > 0) + result = [] items_data = items_data_qb.run(as_dict=1) @@ -320,27 +327,23 @@ def _get_items(pos_profile, price_list, item_group, search_value, attribute_one, filters={"parent": item.item_code, "parentfield": "attributes"}, pluck="attribute_value" ) - if hide_unavailable_items and ( - not item_stock_qty or item_stock_qty < 0 - ): - pass - else: - row = {} - row.update(item) - row.update( - { - "rate": item_price.get("price_list_rate") or 0, - "currency": item_price.get("currency") - or pos_profile.get("currency"), - "item_barcode": item_barcode or [], - "actual_qty": item_stock_qty or 0, - "serial_no_data": serial_no_data or [], - "batch_no_data": batch_no_data or [], - "attributes": attributes or "", - "item_attributes": item_attributes or "", - } - ) - result.append(row) + + row = {} + row.update(item) + row.update( + { + "rate": item_price.get("price_list_rate") or 0, + "currency": item_price.get("currency") + or pos_profile.get("currency"), + "item_barcode": item_barcode or [], + "actual_qty": item_stock_qty or 0, + "serial_no_data": serial_no_data or [], + "batch_no_data": batch_no_data or [], + "attributes": attributes or "", + "item_attributes": item_attributes or "", + } + ) + result.append(row) return result