[pos] refresh() to be called at minimum

This commit is contained in:
Akhilesh Darjee 2013-09-23 12:27:16 +05:30
parent e947081552
commit f624ffa40a
3 changed files with 6 additions and 54 deletions

View File

@ -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);

View File

@ -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() {

View File

@ -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);
}