From 60a05324ce9b7fd1a196cd1bbb291c077d4028a0 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 12 Sep 2016 01:37:46 +0530 Subject: [PATCH] POS changes and fixes --- erpnext/accounts/doctype/sales_invoice/pos.py | 3 - erpnext/accounts/page/pos/pos.js | 55 +++++++++++++++---- erpnext/public/js/pos/pos_invoice_list.html | 7 ++- 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index 5336b5452c..5ed25b432a 100644 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -19,9 +19,6 @@ def get_pos_data(): if pos_profile.get('name'): pos_profile = frappe.get_doc('POS Profile', pos_profile.get('name')) - else: - frappe.msgprint('' - + _("Welcome to POS: Create your POS Profile") + ''); company_data = get_company_data(doc.company) update_pos_profile_data(doc, pos_profile, company_data) diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index f3ee7d0be4..07e55d9a5c 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -128,10 +128,11 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.list_body = this.list_dialog.body; if(this.si_docs.length > 0){ $(this.list_body).append('
\ -
Sr
\ -
Customer
\ +
Sr
\ +
Customer
\
Status
\ -
Grand Total
\ +
Paid Amount
\ +
Grand Total
\
') $.each(this.si_docs, function(index, data){ @@ -140,6 +141,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ sr: index + 1, name: key, customer: data[key].customer, + paid_amount: format_currency(data[key].paid_amount, me.frm.doc.currency), grand_total: format_currency(data[key].grand_total, me.frm.doc.currency), data: me.get_doctype_status(data[key]) })).appendTo($(me.list_body)); @@ -163,12 +165,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ }, get_doctype_status: function(doc){ - if(doc.outstanding_amount == 0){ - return {status: "Paid", indicator: "green"} - }else if(doc.docstatus == 0){ + if(doc.docstatus == 0) { return {status: "Draft", indicator: "red"} - }else if(doc.paid_amount >= 0){ - return {status: "Unpaid", indicator: "orange"} + }else if(doc.outstanding_amount == 0) { + return {status: "Paid", indicator: "green"} + }else { + return {status: "Submitted", indicator: "blue"} } }, @@ -313,6 +315,15 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ }); this.party_field.make_input(); + this.set_focus() + }, + + set_focus: function(){ + if(this.default_customer){ + this.search.$input.focus(); + }else{ + this.party_field.$input.focus(); + } }, make_customer: function() { @@ -728,6 +739,26 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ }, "octicon octicon-plus").addClass("btn-primary"); }, + print_dialog: function(){ + var me = this; + + msgprint = frappe.msgprint(format('{0}\ + {1}', [ + __('Print'), __('New') + ])); + + $('.print_doc').click(function(){ + html = frappe.render(me.print_template, me.frm.doc) + me.print_document(html) + }) + + $('.new_doc').click(function(){ + msgprint.hide() + me.create_new(); + }) + }, + print_document: function(html){ var w = window.open(); w.document.write(html); @@ -740,10 +771,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ submit_invoice: function(){ var me = this; - frappe.confirm(__("Do you really want to submit the invoice?"), function () { - me.change_status(); - frappe.msgprint(__("Sales invoice submitted sucessfully.")) - }) + this.change_status(); + if(this.frm.doc.docstatus == 1){ + this.print_dialog() + } }, change_status: function(){ diff --git a/erpnext/public/js/pos/pos_invoice_list.html b/erpnext/public/js/pos/pos_invoice_list.html index c0b4764129..6eecfe3b81 100644 --- a/erpnext/public/js/pos/pos_invoice_list.html +++ b/erpnext/public/js/pos/pos_invoice_list.html @@ -1,6 +1,7 @@
-
{%= sr %}
-
{%= customer %}
+
{%= sr %}
+
{%= customer %}
{{ data.status }}
-
{%= grand_total %}
+
{%= paid_amount %}
+
{%= grand_total %}