\
- %(item_image)s\
+
%(item_image)s
\
%(item_code)s
\
%(item_name)s
\
%(item_price)s
\
@@ -196,13 +199,16 @@ erpnext.POS = Class.extend({
})).appendTo($wrap);
});
- $("div.pos-item").on("click", function() {
- if(!cur_frm.doc.customer) {
- msgprint("Please select customer first.");
- return;
- }
- me.add_to_cart($(this).attr("data-item_code"));
- });
+ // if form is local then allow this function
+ if (cur_frm.doc.docstatus===0) {
+ $("div.pos-item").on("click", function() {
+ if(!cur_frm.doc.customer) {
+ msgprint("Please select customer first.");
+ return;
+ }
+ me.add_to_cart($(this).attr("data-item_code"));
+ });
+ }
}
});
},
@@ -230,22 +236,25 @@ erpnext.POS = Class.extend({
var child = wn.model.add_child(me.frm.doc, "Sales Invoice Item", "entries");
child.item_code = item_code;
me.frm.cscript.item_code(me.frm.doc, child.doctype, child.name);
- //me.refresh();
}
},
- update_qty: function(item_code, qty) {
+ update_qty: function(item_code, qty, textbox_qty) {
var me = this;
$.each(wn.model.get_children("Sales Invoice Item", this.frm.doc.name, "entries",
"Sales Invoice"), function(i, d) {
if (d.item_code == item_code) {
- if (qty == 1)
- d.qty += 1;
- else
+ if (textbox_qty) {
+ if (qty == 0 && d.item_code == item_code)
+ wn.model.clear_doc(d.doctype, d.name);
d.qty = qty;
+ }
+ else
+ d.qty += 1;
me.frm.cscript.qty(me.frm.doc, d.doctype, d.name);
}
});
+ me.frm.dirty();
me.refresh();
},
refresh: function() {
@@ -262,7 +271,7 @@ erpnext.POS = Class.extend({
%(item_code)s%(item_name)s | \
| \
-
%(rate)s %(amount)s | \
+
%(amount)s %(rate)s | \