[pos][minor] fixed sales_invoice.js for pos view

This commit is contained in:
Akhilesh Darjee
2013-08-28 11:50:01 +05:30
38 changed files with 355 additions and 82 deletions

View File

@@ -261,13 +261,11 @@ class DocType(BuyingController):
if d.purchase_order:
submitted = sql("select name from `tabPurchase Order` where docstatus = 1 and name = '%s'" % d.purchase_order)
if not submitted:
msgprint("Purchase Order : "+ cstr(d.purchase_order) +" is not submitted")
raise Exception , "Validation Error."
webnotes.throw("Purchase Order : "+ cstr(d.purchase_order) +" is not submitted")
if d.purchase_receipt:
submitted = sql("select name from `tabPurchase Receipt` where docstatus = 1 and name = '%s'" % d.purchase_receipt)
if not submitted:
msgprint("Purchase Receipt : "+ cstr(d.purchase_receipt) +" is not submitted")
raise Exception , "Validation Error."
webnotes.throw("Purchase Receipt : "+ cstr(d.purchase_receipt) +" is not submitted")
def update_against_document_in_jv(self):

View File

@@ -16,7 +16,7 @@ erpnext.POS = Class.extend({
<div class="col-sm-6">\
<div class="pos-bill">\
<div class="item-cart">\
<table class="table table-condensed table-hover" id="cart" style="table-layout: fixed;">\
<table class="table table-condensed table-hover" id="cart" style="table-layout: fixed;">\
<thead>\
<tr>\
<th style="width: 50%">Item</th>\
@@ -160,13 +160,10 @@ erpnext.POS = Class.extend({
parent: this.wrapper.find(".barcode-area")
});
this.barcode.make_input();
this.barcode.$input.on("keypress", function() {
setTimeout(function() { me.barcode_timeout(); }, 1000);
this.barcode.$input.on("change", function() {
setTimeout(me.add_item_thru_barcode(), 1000);
});
},
barcode_timeout: function() {
me.add_item_thru_barcode();
},
make_item_list: function() {
var me = this;
wn.call({
@@ -181,12 +178,13 @@ erpnext.POS = Class.extend({
me.wrapper.find(".item-list").empty();
$.each(r.message, function(index, obj) {
if (obj.image)
image = '<img src="' + obj.image + '" class="img-responsive" style="border: 1px solid #eee;">';
image = '<img src="' + obj.image + '" class="img-responsive" \
style="border:1px solid #eee;height:140px;width:122px;">';
else
image = '<div class="missing-image"><i class="icon-camera"></i></div>';
$(repl('<div class="col-xs-3 pos-item" data-item_code="%(item_code)s">\
%(item_image)s\
<div>%(item_image)s</div>\
<div class="small">%(item_code)s</div>\
<div class="small">%(item_name)s</div>\
<div class="small">%(item_price)s</div>\
@@ -332,7 +330,6 @@ erpnext.POS = Class.extend({
},
add_item_thru_barcode: function() {
var me = this;
clearTimeout();
wn.call({
method: 'accounts.doctype.sales_invoice.pos.get_item_from_barcode',
args: {barcode: this.barcode.$input.val()},
@@ -363,6 +360,7 @@ erpnext.POS = Class.extend({
$.each(child, function(i, d) {
for (var i in selected_items) {
if (d.item_code == selected_items[i]) {
// cur_frm.fields_dict["entries"].grid.grid_rows[d.idx].remove();
wn.model.clear_doc(d.doctype, d.name);
}
}
@@ -401,6 +399,7 @@ erpnext.POS = Class.extend({
"total_amount": $(".grand-total").text()
});
dialog.show();
cur_frm.pos.barcode.$input.focus();
dialog.get_input("total_amount").attr("disabled", "disabled");

View File

@@ -93,14 +93,13 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
}
});
});
if (cint(sys_defaults.fs_pos_view)===1)
cur_frm.cscript.pos_btn();
} else {
// hide shown pos for submitted records
if(cur_frm.pos_active) cur_frm.cscript.toggle_pos(false);
}
if(cint(sys_defaults.fs_pos_view)===1)
cur_frm.cscript.pos_btn();
},
pos_btn: function() {
@@ -123,6 +122,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
},
toggle_pos: function(show) {
// if(cint(sys_defaults.fs_pos_view)===0) return;
// if(!(this.frm.doc.is_pos && this.frm.doc.docstatus===0)) return;
if (!this.frm.doc.selling_price_list)
msgprint(wn._("Please select Price List"))
else {