From 82fc04e77eb6d52a27acaf9d1cc72d73b495b271 Mon Sep 17 00:00:00 2001 From: Yousef Restom Date: Wed, 20 Jul 2022 11:33:07 +0000 Subject: [PATCH 01/13] feat: Variants divider --- posawesome/public/js/posapp/components/pos/Variants.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posawesome/public/js/posapp/components/pos/Variants.vue b/posawesome/public/js/posapp/components/pos/Variants.vue index 8ac5ab9b..082c0dea 100644 --- a/posawesome/public/js/posapp/components/pos/Variants.vue +++ b/posawesome/public/js/posapp/components/pos/Variants.vue @@ -26,8 +26,8 @@ {{ value.attribute_value }} + -
Date: Wed, 20 Jul 2022 11:35:20 +0000 Subject: [PATCH 02/13] fix: amended_from twice in POS Closing Shift #181 --- .../posawesome/doctype/pos_closing_shift/pos_closing_shift.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posawesome/posawesome/doctype/pos_closing_shift/pos_closing_shift.json b/posawesome/posawesome/doctype/pos_closing_shift/pos_closing_shift.json index 87aca200..655534b2 100644 --- a/posawesome/posawesome/doctype/pos_closing_shift/pos_closing_shift.json +++ b/posawesome/posawesome/doctype/pos_closing_shift/pos_closing_shift.json @@ -197,7 +197,7 @@ ], "is_submittable": 1, "links": [], - "modified": "2022-05-11 14:02:31.360797", + "modified": "2022-07-20 14:34:51.942826", "modified_by": "Administrator", "module": "POSAwesome", "name": "POS Closing Shift", From 8bfd8ea5ffa4c2998bc2cc1012384ccf1ce4d273 Mon Sep 17 00:00:00 2001 From: Yousef Restom Date: Wed, 20 Jul 2022 12:06:49 +0000 Subject: [PATCH 03/13] fix: remove unnecessary import --- posawesome/posawesome/api/posapp.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/posawesome/posawesome/api/posapp.py b/posawesome/posawesome/api/posapp.py index edfd403a..624aa468 100644 --- a/posawesome/posawesome/api/posapp.py +++ b/posawesome/posawesome/api/posapp.py @@ -24,8 +24,6 @@ ) from posawesome.posawesome.doctype.pos_coupon.pos_coupon import check_coupon_code -from posawesome import console - @frappe.whitelist() def get_opening_dialog_data(): From 6cf9cd40c3e1c7a84a70e570ab8c442dced1999b Mon Sep 17 00:00:00 2001 From: Yousef Restom Date: Wed, 20 Jul 2022 12:20:04 +0000 Subject: [PATCH 04/13] feat: checkbox to enable or disable free items #175 --- posawesome/fixtures/custom_field.json | 183 +++++++++++++++++--------- posawesome/hooks.py | 1 + posawesome/posawesome/api/posapp.py | 19 ++- 3 files changed, 133 insertions(+), 70 deletions(-) diff --git a/posawesome/fixtures/custom_field.json b/posawesome/fixtures/custom_field.json index e86a9a61..8819d657 100644 --- a/posawesome/fixtures/custom_field.json +++ b/posawesome/fixtures/custom_field.json @@ -1604,8 +1604,8 @@ "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_column_break_112", - "fieldtype": "Column Break", + "fieldname": "posa_allow_zero_rated_items", + "fieldtype": "Check", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -1617,11 +1617,11 @@ "in_preview": 0, "in_standard_filter": 0, "insert_after": "posa_display_item_code", - "label": "", + "label": "Allow Zero Rated Items", "length": 0, "mandatory_depends_on": null, - "modified": "2021-06-23 22:48:40.886230", - "name": "POS Profile-posa_column_break_112", + "modified": "2022-07-20 15:09:09.652861", + "name": "POS Profile-posa_allow_zero_rated_items", "no_copy": 0, "non_negative": 0, "options": null, @@ -1657,8 +1657,8 @@ "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_allow_sales_order", - "fieldtype": "Check", + "fieldname": "posa_column_break_112", + "fieldtype": "Column Break", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -1669,12 +1669,12 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_column_break_112", - "label": "Allow Create Sales Order", + "insert_after": "posa_allow_zero_rated_items", + "label": "", "length": 0, "mandatory_depends_on": null, - "modified": "2021-06-22 03:02:27.784096", - "name": "POS Profile-posa_allow_sales_order", + "modified": "2021-06-23 22:48:40.886230", + "name": "POS Profile-posa_column_break_112", "no_copy": 0, "non_negative": 0, "options": null, @@ -1763,7 +1763,7 @@ "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_show_template_items", + "fieldname": "posa_allow_sales_order", "fieldtype": "Check", "hidden": 0, "hide_border": 0, @@ -1775,12 +1775,12 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_allow_sales_order", - "label": "Show Template Items", + "insert_after": "posa_column_break_112", + "label": "Allow Create Sales Order", "length": 0, "mandatory_depends_on": null, - "modified": "2021-06-23 22:48:41.288938", - "name": "POS Profile-posa_show_template_items", + "modified": "2021-06-22 03:02:27.784096", + "name": "POS Profile-posa_allow_sales_order", "no_copy": 0, "non_negative": 0, "options": null, @@ -1862,14 +1862,14 @@ "collapsible_depends_on": null, "columns": 0, "default": null, - "depends_on": "posa_show_template_items", + "depends_on": null, "description": null, "docstatus": 0, "doctype": "Custom Field", "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_hide_variants_items", + "fieldname": "posa_show_template_items", "fieldtype": "Check", "hidden": 0, "hide_border": 0, @@ -1881,12 +1881,12 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_show_template_items", - "label": "Hide Variants Items", + "insert_after": "posa_allow_sales_order", + "label": "Show Template Items", "length": 0, "mandatory_depends_on": null, - "modified": "2021-06-24 03:24:52.591942", - "name": "POS Profile-posa_hide_variants_items", + "modified": "2021-06-23 22:48:41.288938", + "name": "POS Profile-posa_show_template_items", "no_copy": 0, "non_negative": 0, "options": null, @@ -1968,14 +1968,14 @@ "collapsible_depends_on": null, "columns": 0, "default": null, - "depends_on": null, + "depends_on": "posa_show_template_items", "description": null, "docstatus": 0, "doctype": "Custom Field", "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_fetch_coupon", + "fieldname": "posa_hide_variants_items", "fieldtype": "Check", "hidden": 0, "hide_border": 0, @@ -1987,12 +1987,12 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_hide_variants_items", - "label": "Auto Fetch Coupon Gifts", + "insert_after": "posa_show_template_items", + "label": "Hide Variants Items", "length": 0, "mandatory_depends_on": null, - "modified": "2021-07-29 22:58:10.372543", - "name": "POS Profile-posa_fetch_coupon", + "modified": "2021-06-24 03:24:52.591942", + "name": "POS Profile-posa_hide_variants_items", "no_copy": 0, "non_negative": 0, "options": null, @@ -2073,7 +2073,7 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": "0", + "default": null, "depends_on": null, "description": null, "docstatus": 0, @@ -2081,7 +2081,7 @@ "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_allow_customer_purchase_order", + "fieldname": "posa_fetch_coupon", "fieldtype": "Check", "hidden": 0, "hide_border": 0, @@ -2093,12 +2093,12 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_fetch_coupon", - "label": "Allow Customer Purchase Order", + "insert_after": "posa_hide_variants_items", + "label": "Auto Fetch Coupon Gifts", "length": 0, "mandatory_depends_on": null, - "modified": "2021-12-16 16:27:32.300240", - "name": "POS Profile-posa_allow_customer_purchase_order", + "modified": "2021-07-29 22:58:10.372543", + "name": "POS Profile-posa_fetch_coupon", "no_copy": 0, "non_negative": 0, "options": null, @@ -2187,7 +2187,7 @@ "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_allow_print_last_invoice", + "fieldname": "posa_allow_customer_purchase_order", "fieldtype": "Check", "hidden": 0, "hide_border": 0, @@ -2199,12 +2199,12 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_allow_customer_purchase_order", - "label": "Allow Print Last Invoice", + "insert_after": "posa_fetch_coupon", + "label": "Allow Customer Purchase Order", "length": 0, "mandatory_depends_on": null, - "modified": "2021-12-16 18:00:40.631156", - "name": "POS Profile-posa_allow_print_last_invoice", + "modified": "2021-12-16 16:27:32.300240", + "name": "POS Profile-posa_allow_customer_purchase_order", "no_copy": 0, "non_negative": 0, "options": null, @@ -2338,7 +2338,7 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": null, + "default": "0", "depends_on": null, "description": null, "docstatus": 0, @@ -2346,7 +2346,7 @@ "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_display_additional_notes", + "fieldname": "posa_allow_print_last_invoice", "fieldtype": "Check", "hidden": 0, "hide_border": 0, @@ -2358,12 +2358,12 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_allow_print_last_invoice", - "label": "Display Additional Notes", + "insert_after": "posa_allow_customer_purchase_order", + "label": "Allow Print Last Invoice", "length": 0, "mandatory_depends_on": null, - "modified": "2021-12-19 16:54:32.986600", - "name": "POS Profile-posa_display_additional_notes", + "modified": "2021-12-16 18:00:40.631156", + "name": "POS Profile-posa_allow_print_last_invoice", "no_copy": 0, "non_negative": 0, "options": null, @@ -2438,7 +2438,7 @@ "width": null }, { - "allow_in_quick_entry": 1, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2449,11 +2449,11 @@ "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Customer", + "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_referral_code", - "fieldtype": "Data", + "fieldname": "posa_display_additional_notes", + "fieldtype": "Check", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2464,13 +2464,13 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_referral_section", - "label": "Referral Code", + "insert_after": "posa_allow_print_last_invoice", + "label": "Display Additional Notes", "length": 0, "mandatory_depends_on": null, - "modified": "2021-07-29 22:42:57.772021", - "name": "Customer-posa_referral_code", - "no_copy": 1, + "modified": "2021-12-19 16:54:32.986600", + "name": "POS Profile-posa_display_additional_notes", + "no_copy": 0, "non_negative": 0, "options": null, "parent": null, @@ -2486,12 +2486,12 @@ "report_hide": 0, "reqd": 0, "search_index": 0, - "translatable": 1, + "translatable": 0, "unique": 0, "width": null }, { - "allow_in_quick_entry": 0, + "allow_in_quick_entry": 1, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2502,11 +2502,11 @@ "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "POS Profile", + "dt": "Customer", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_allow_write_off_change", - "fieldtype": "Check", + "fieldname": "posa_referral_code", + "fieldtype": "Data", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2517,13 +2517,13 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_display_additional_notes", - "label": "Allow Write Off Change", + "insert_after": "posa_referral_section", + "label": "Referral Code", "length": 0, "mandatory_depends_on": null, - "modified": "2022-02-12 04:26:04.003374", - "name": "POS Profile-posa_allow_write_off_change", - "no_copy": 0, + "modified": "2021-07-29 22:42:57.772021", + "name": "Customer-posa_referral_code", + "no_copy": 1, "non_negative": 0, "options": null, "parent": null, @@ -2539,7 +2539,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, - "translatable": 0, + "translatable": 1, "unique": 0, "width": null }, @@ -2596,6 +2596,59 @@ "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": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "POS Profile", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "posa_allow_write_off_change", + "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_display_additional_notes", + "label": "Allow Write Off Change", + "length": 0, + "mandatory_depends_on": null, + "modified": "2022-02-12 04:26:04.003374", + "name": "POS Profile-posa_allow_write_off_change", + "no_copy": 0, + "non_negative": 0, + "options": null, + "parent": null, + "parentfield": null, + "parenttype": 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, + "translatable": 0, + "unique": 0, + "width": null + }, { "allow_in_quick_entry": 0, "allow_on_submit": 0, diff --git a/posawesome/hooks.py b/posawesome/hooks.py index 25b950c2..1aefb62a 100644 --- a/posawesome/hooks.py +++ b/posawesome/hooks.py @@ -225,6 +225,7 @@ "POS Profile-posa_new_line", "POS Profile-posa_input_qty", "POS Profile-posa_display_item_code", + "POS Profile-posa_allow_zero_rated_items", ), ] ], diff --git a/posawesome/posawesome/api/posapp.py b/posawesome/posawesome/api/posapp.py index 624aa468..1c217dc7 100644 --- a/posawesome/posawesome/api/posapp.py +++ b/posawesome/posawesome/api/posapp.py @@ -323,12 +323,13 @@ def get_customer_names(pos_profile): ) return customers + @frappe.whitelist() -def get_sales_person_names(): +def get_sales_person_names(): sales_persons = frappe.db.sql( """ SELECT name, sales_person_name - FROM `tabSales Person` + FROM `tabSales Person` ORDER by name LIMIT 0, 10000 """, @@ -336,6 +337,7 @@ def get_sales_person_names(): ) return sales_persons + @frappe.whitelist() def update_invoice(data): data = json.loads(data) @@ -353,11 +355,18 @@ def update_invoice(data): ref_doc = frappe.get_doc(invoice_doc.doctype, invoice_doc.return_against) if not ref_doc.update_stock: invoice_doc.update_stock = 0 - + allow_zero_rated_items = frappe.get_cached_value( + "POS Profile", invoice_doc.pos_profile, "posa_allow_zero_rated_items" + ) for item in invoice_doc.items: if not item.rate or item.rate == 0: - item.price_list_rate = 0.00 - item.is_free_item = 1 + if allow_zero_rated_items: + item.price_list_rate = 0.00 + item.is_free_item = 1 + else: + frappe.throw( + _("Rate cannot be zero for item {0}").format(item.item_code) + ) else: item.is_free_item = 0 add_taxes_from_tax_template(item, invoice_doc) From 8c469d8353fb953dd941a19ff7205a40063eb926 Mon Sep 17 00:00:00 2001 From: Yousef Restom Date: Fri, 22 Jul 2022 09:32:22 +0000 Subject: [PATCH 05/13] feat: Allow Print Draft Invoices --- posawesome/fixtures/custom_field.json | 95 +++++++++++++++---- posawesome/hooks.py | 1 + .../js/posapp/components/pos/Invoice.vue | 67 ++++++++++++- 3 files changed, 139 insertions(+), 24 deletions(-) diff --git a/posawesome/fixtures/custom_field.json b/posawesome/fixtures/custom_field.json index 8819d657..534bcb24 100644 --- a/posawesome/fixtures/custom_field.json +++ b/posawesome/fixtures/custom_field.json @@ -2755,6 +2755,59 @@ "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": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "POS Profile", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "posa_allow_print_draft_invoices", + "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_input_qty", + "label": "Allow Print Draft Invoices", + "length": 0, + "mandatory_depends_on": null, + "modified": "2022-07-22 11:51:07.782265", + "name": "POS Profile-posa_allow_print_draft_invoices", + "no_copy": 0, + "non_negative": 0, + "options": null, + "parent": null, + "parentfield": null, + "parenttype": 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, + "translatable": 0, + "unique": 0, + "width": null + }, { "allow_in_quick_entry": 0, "allow_on_submit": 0, @@ -2782,7 +2835,7 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_input_qty", + "insert_after": "posa_allow_print_draft_invoices", "label": "POS Awesome Advance Settings", "length": 0, "mandatory_depends_on": null, @@ -2974,16 +3027,16 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": "1", + "default": null, "depends_on": null, "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "POS Profile", + "dt": "Sales Invoice Item", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_tax_inclusive", - "fieldtype": "Check", + "fieldname": "posa_offers", + "fieldtype": "Small Text", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -2994,12 +3047,12 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "posa_search_serial_no", - "label": "Tax Inclusive", + "insert_after": "pricing_rules", + "label": "POS Offers", "length": 0, "mandatory_depends_on": null, - "modified": "2021-09-06 16:33:33.398280", - "name": "POS Profile-posa_tax_inclusive", + "modified": "2021-06-07 01:51:16.390447", + "name": "Sales Invoice Item-posa_offers", "no_copy": 0, "non_negative": 0, "options": null, @@ -3011,12 +3064,12 @@ "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, + "translatable": 1, "unique": 0, "width": null }, @@ -3027,16 +3080,16 @@ "collapsible": 0, "collapsible_depends_on": null, "columns": 0, - "default": null, + "default": "1", "depends_on": null, "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Sales Invoice Item", + "dt": "POS Profile", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "posa_offers", - "fieldtype": "Small Text", + "fieldname": "posa_tax_inclusive", + "fieldtype": "Check", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -3047,12 +3100,12 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "pricing_rules", - "label": "POS Offers", + "insert_after": "posa_search_serial_no", + "label": "Tax Inclusive", "length": 0, "mandatory_depends_on": null, - "modified": "2021-06-07 01:51:16.390447", - "name": "Sales Invoice Item-posa_offers", + "modified": "2021-09-06 16:33:33.398280", + "name": "POS Profile-posa_tax_inclusive", "no_copy": 0, "non_negative": 0, "options": null, @@ -3064,12 +3117,12 @@ "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, + "translatable": 0, "unique": 0, "width": null }, diff --git a/posawesome/hooks.py b/posawesome/hooks.py index 1aefb62a..38f77343 100644 --- a/posawesome/hooks.py +++ b/posawesome/hooks.py @@ -226,6 +226,7 @@ "POS Profile-posa_input_qty", "POS Profile-posa_display_item_code", "POS Profile-posa_allow_zero_rated_items", + "POS Profile-posa_allow_print_draft_invoices", ), ] ], diff --git a/posawesome/public/js/posapp/components/pos/Invoice.vue b/posawesome/public/js/posapp/components/pos/Invoice.vue index 24eb746a..e97cbe6d 100644 --- a/posawesome/public/js/posapp/components/pos/Invoice.vue +++ b/posawesome/public/js/posapp/components/pos/Invoice.vue @@ -617,7 +617,7 @@ >{{ __('Save/New') }} - + {{ __('PAY') }} + + {{ __('Print Draft') }} + @@ -887,6 +901,7 @@ export default { }, new_invoice(data = {}) { + let old_invoice = null; evntBus.$emit('set_customer_readonly', false); this.expanded = []; this.posa_offers = []; @@ -895,10 +910,10 @@ export default { this.return_doc = ''; const doc = this.get_invoice_doc(); if (doc.name) { - this.update_invoice(doc); + old_invoice = this.update_invoice(doc); } else { if (doc.items.length) { - this.update_invoice(doc); + old_invoice = this.update_invoice(doc); } } if (!data.name && !data.is_return) { @@ -944,6 +959,7 @@ export default { } }); } + return old_invoice; }, get_invoice_doc() { @@ -2257,6 +2273,51 @@ export default { }, 0); } }, + load_print_page(invoice_name) { + const print_format = + this.pos_profile.print_format_for_online || + this.pos_profile.print_format; + const letter_head = this.pos_profile.letter_head || 0; + const url = + frappe.urllib.get_base_url() + + '/printview?doctype=Sales%20Invoice&name=' + + invoice_name + + '&trigger_print=1' + + '&format=' + + print_format + + '&no_letterhead=' + + letter_head; + const printWindow = window.open(url, 'Print'); + printWindow.addEventListener( + 'load', + function () { + printWindow.print(); + // printWindow.close(); + // NOTE : uncomoent this to auto closing printing window + }, + true + ); + }, + + print_draft_invoice() { + if (!this.pos_profile.posa_allow_print_draft_invoices) { + evntBus.$emit('show_mesage', { + text: __(`You are not allowed to print draft invoices`), + color: 'error', + }); + return; + } + let invoice_name = this.invoice_doc.name; + frappe.run_serially([ + () => { + const invoice_doc = this.new_invoice(); + invoice_name = invoice_doc.name ? invoice_doc.name : invoice_name; + }, + () => { + this.load_print_page(invoice_name); + }, + ]); + }, }, created() { From 9f59c8e8312c78cb441c29eeb58b836096447281 Mon Sep 17 00:00:00 2001 From: Yousef Restom Date: Sat, 23 Jul 2022 15:37:40 +0000 Subject: [PATCH 06/13] feat: New Theme --- .../public/js/posapp/components/Navbar.vue | 15 +++- .../posapp/components/pos/ClosingDialog.vue | 12 +++- .../js/posapp/components/pos/Customer.vue | 4 +- .../js/posapp/components/pos/Drafts.vue | 36 +++++----- .../js/posapp/components/pos/EditCustomer.vue | 8 +-- .../js/posapp/components/pos/Invoice.vue | 60 ++++++++-------- .../posapp/components/pos/ItemsSelector.vue | 25 ++++--- .../posapp/components/pos/Mpesa-Payments.vue | 8 +-- .../js/posapp/components/pos/NewAddress.vue | 20 ++++-- .../js/posapp/components/pos/NewCustomer.vue | 22 +++--- .../posapp/components/pos/OpeningDialog.vue | 4 +- .../js/posapp/components/pos/Payments.vue | 66 +++++++++--------- .../js/posapp/components/pos/PosCoupons.vue | 6 +- .../js/posapp/components/pos/PosOffers.vue | 6 +- .../js/posapp/components/pos/Returns.vue | 12 ++-- .../js/posapp/components/pos/Variants.vue | 4 +- .../public/js/posapp/components/pos/pos.png | Bin 0 -> 20232 bytes posawesome/public/js/posapp/posapp.js | 25 ++++++- 18 files changed, 195 insertions(+), 138 deletions(-) create mode 100644 posawesome/public/js/posapp/components/pos/pos.png diff --git a/posawesome/public/js/posapp/components/Navbar.vue b/posawesome/public/js/posapp/components/Navbar.vue index 368e3008..caa938f5 100644 --- a/posawesome/public/js/posapp/components/Navbar.vue +++ b/posawesome/public/js/posapp/components/Navbar.vue @@ -5,23 +5,32 @@ @click.stop="drawer = !drawer" class="grey--text" > + pos awesome - + {{ pos_profile.name }}
diff --git a/posawesome/public/js/posapp/components/pos/ClosingDialog.vue b/posawesome/public/js/posapp/components/pos/ClosingDialog.vue index d66cda1b..8414b047 100644 --- a/posawesome/public/js/posapp/components/pos/ClosingDialog.vue +++ b/posawesome/public/js/posapp/components/pos/ClosingDialog.vue @@ -3,7 +3,9 @@ - {{__('Closing POS Shift')}} + {{ + __('Closing POS Shift') + }} @@ -54,8 +56,12 @@ - {{__('Close')}} - {{__('Submit')}} + {{ + __('Close') + }} + {{ + __('Submit') + }} diff --git a/posawesome/public/js/posapp/components/pos/Customer.vue b/posawesome/public/js/posapp/components/pos/Customer.vue index 63b89127..55c44694 100644 --- a/posawesome/public/js/posapp/components/pos/Customer.vue +++ b/posawesome/public/js/posapp/components/pos/Customer.vue @@ -5,7 +5,7 @@ clearable auto-select-first outlined - color="indigo" + color="primary" :label="frappe._('Customer')" v-model="customer" :items="customers" @@ -25,7 +25,7 @@