From f624ffa40abcf5aca9c4d0c6295f5bb00c856ca9 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Mon, 23 Sep 2013 12:27:16 +0530 Subject: [PATCH] [pos] refresh() to be called at minimum --- accounts/doctype/sales_invoice/pos.js | 8 +-- .../doctype/sales_invoice/sales_invoice.js | 50 +------------------ public/js/transaction.js | 2 +- 3 files changed, 6 insertions(+), 54 deletions(-) diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js index c76db1394f9..4ef239744b6 100644 --- a/accounts/doctype/sales_invoice/pos.js +++ b/accounts/doctype/sales_invoice/pos.js @@ -106,7 +106,7 @@ erpnext.POS = Class.extend({ this.make_item_list(); }, make_party: function() { - var me = this; + var me = this; this.party_field = wn.ui.form.make_control({ df: { "fieldtype": "Link", @@ -179,7 +179,7 @@ erpnext.POS = Class.extend({ }); }, make_item_list: function() { - var me = this; + var me = this; wn.call({ method: 'accounts.doctype.sales_invoice.pos.get_items', args: { @@ -349,7 +349,6 @@ erpnext.POS = Class.extend({ }); - this.make_item_list(); me.refresh_delete_btn(); cur_frm.pos.barcode.$input.focus(); } @@ -368,7 +367,8 @@ erpnext.POS = Class.extend({ $(".make-payment").hide(); if (this.frm.doctype == "Quotation") - $(".party-area").toggle(cur_frm.doc.quotation_to=="Customer" ? true : false) + if (cur_frm.doc.quotation_to=="Customer") + this.party_field.remove(); }, refresh_delete_btn: function() { $(".delete-items").toggle($(".item-cart .warning").length ? true : false); diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index e07ed2816d3..13cbc634dd2 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -121,54 +121,6 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte }); }); }, - - // pos_btn: function() { - // if(cur_frm.$pos_btn) - // cur_frm.$pos_btn.remove(); - - // if(!cur_frm.pos_active) { - // var btn_label = wn._("POS View"), - // icon = "icon-desktop"; - - // cur_frm.cscript.sales_order_btn(); - // cur_frm.cscript.delivery_note_btn(); - // } else { - // var btn_label = wn._("Invoice View"), - // icon = "icon-file-text"; - - // if (cur_frm.doc.docstatus===0) { - // this.$delivery_note_btn.remove(); - // this.$sales_order_btn.remove(); - // } - // } - - // cur_frm.$pos_btn = cur_frm.add_custom_button(btn_label, function() { - // cur_frm.cscript.toggle_pos(); - // cur_frm.cscript.pos_btn(); - // }, icon); - // }, - - // toggle_pos: function(show) { - // if (!this.frm.doc.selling_price_list) - // msgprint(wn._("Please select Price List")) - // else { - // if((show===true && cur_frm.pos_active) || (show===false && !cur_frm.pos_active)) return; - - // // make pos - // if(!cur_frm.pos) { - // cur_frm.layout.add_view("pos"); - // cur_frm.pos = new erpnext.POS(cur_frm.layout.views.pos, cur_frm); - // } - - // // toggle view - // cur_frm.layout.set_view(cur_frm.pos_active ? "" : "pos"); - // cur_frm.pos_active = !cur_frm.pos_active; - - // // refresh - // if(cur_frm.pos_active) - // cur_frm.pos.refresh(); - // } - // }, tc_name: function() { this.get_terms(); @@ -176,7 +128,6 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte is_pos: function() { cur_frm.cscript.hide_fields(this.frm.doc); - if(cint(this.frm.doc.is_pos)) { if(!this.frm.doc.company) { this.frm.set_value("is_pos", 0); @@ -194,6 +145,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte }); } } + }, debit_to: function() { diff --git a/public/js/transaction.js b/public/js/transaction.js index a38e3a777cc..1a1c98ca6bf 100644 --- a/public/js/transaction.js +++ b/public/js/transaction.js @@ -98,7 +98,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ if((show===true && this.pos_active) || (show===false && !this.pos_active)) return; // make pos - if(!this.pos) { + if(!this.frm.pos) { this.frm.layout.add_view("pos"); this.frm.pos = new erpnext.POS(this.frm.layout.views.pos, this.frm); }