[pos] moved pos realted code from sales_invoice.js to transaction.js
This commit is contained in:
parent
6773bc2512
commit
a550e7443f
@ -96,6 +96,7 @@ erpnext.POS = Class.extend({
|
|||||||
},
|
},
|
||||||
make_customer: function() {
|
make_customer: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
console.log(this.frm);
|
||||||
this.customer = wn.ui.form.make_control({
|
this.customer = wn.ui.form.make_control({
|
||||||
df: {
|
df: {
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
@ -109,7 +110,7 @@ erpnext.POS = Class.extend({
|
|||||||
this.customer.make_input();
|
this.customer.make_input();
|
||||||
this.customer.$input.on("change", function() {
|
this.customer.$input.on("change", function() {
|
||||||
if(!me.customer.autocomplete_open)
|
if(!me.customer.autocomplete_open)
|
||||||
wn.model.set_value("Sales Invoice", me.frm.docname, "customer", this.value);
|
wn.model.set_value(this.frm.doctype, me.frm.docname, "customer", this.value);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
make_item_group: function() {
|
make_item_group: function() {
|
||||||
@ -221,8 +222,8 @@ erpnext.POS = Class.extend({
|
|||||||
|
|
||||||
// check whether the item is already added
|
// check whether the item is already added
|
||||||
if (no_of_items != 0) {
|
if (no_of_items != 0) {
|
||||||
$.each(wn.model.get_children("Sales Invoice Item", this.frm.doc.name, "entries",
|
$.each(wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, "entries",
|
||||||
"Sales Invoice"), function(i, d) {
|
this.frm.doctype), function(i, d) {
|
||||||
if (d.item_code == item_code)
|
if (d.item_code == item_code)
|
||||||
caught = true;
|
caught = true;
|
||||||
});
|
});
|
||||||
@ -233,15 +234,15 @@ erpnext.POS = Class.extend({
|
|||||||
me.update_qty(item_code, 1);
|
me.update_qty(item_code, 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var child = wn.model.add_child(me.frm.doc, "Sales Invoice Item", "entries");
|
var child = wn.model.add_child(me.frm.doc, this.frm.doctype + " Item", "entries");
|
||||||
child.item_code = item_code;
|
child.item_code = item_code;
|
||||||
me.frm.cscript.item_code(me.frm.doc, child.doctype, child.name);
|
me.frm.cscript.item_code(me.frm.doc, child.doctype, child.name);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
update_qty: function(item_code, qty, textbox_qty) {
|
update_qty: function(item_code, qty, textbox_qty) {
|
||||||
var me = this;
|
var me = this;
|
||||||
$.each(wn.model.get_children("Sales Invoice Item", this.frm.doc.name, "entries",
|
$.each(wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, "entries",
|
||||||
"Sales Invoice"), function(i, d) {
|
this.frm.doctype), function(i, d) {
|
||||||
if (d.item_code == item_code) {
|
if (d.item_code == item_code) {
|
||||||
if (textbox_qty) {
|
if (textbox_qty) {
|
||||||
if (qty == 0 && d.item_code == item_code)
|
if (qty == 0 && d.item_code == item_code)
|
||||||
@ -265,8 +266,8 @@ erpnext.POS = Class.extend({
|
|||||||
// add items
|
// add items
|
||||||
var $items = me.wrapper.find("#cart tbody").empty();
|
var $items = me.wrapper.find("#cart tbody").empty();
|
||||||
|
|
||||||
$.each(wn.model.get_children("Sales Invoice Item", this.frm.doc.name, "entries",
|
$.each(wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, "entries",
|
||||||
"Sales Invoice"), function(i, d) {
|
this.frm.doctype), function(i, d) {
|
||||||
$(repl('<tr id="%(item_code)s" data-selected="false">\
|
$(repl('<tr id="%(item_code)s" data-selected="false">\
|
||||||
<td>%(item_code)s%(item_name)s</td>\
|
<td>%(item_code)s%(item_name)s</td>\
|
||||||
<td><input type="text" value="%(qty)s" \
|
<td><input type="text" value="%(qty)s" \
|
||||||
@ -285,7 +286,7 @@ erpnext.POS = Class.extend({
|
|||||||
|
|
||||||
// taxes
|
// taxes
|
||||||
var taxes = wn.model.get_children("Sales Taxes and Charges", this.frm.doc.name, "other_charges",
|
var taxes = wn.model.get_children("Sales Taxes and Charges", this.frm.doc.name, "other_charges",
|
||||||
"Sales Invoice");
|
this.frm.doctype);
|
||||||
$(".tax-table")
|
$(".tax-table")
|
||||||
.toggle((taxes && taxes.length) ? true : false)
|
.toggle((taxes && taxes.length) ? true : false)
|
||||||
.find("tbody").empty();
|
.find("tbody").empty();
|
||||||
@ -378,8 +379,8 @@ erpnext.POS = Class.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var child = wn.model.get_children("Sales Invoice Item", this.frm.doc.name, "entries",
|
var child = wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, "entries",
|
||||||
"Sales Invoice");
|
this.frm.doctype);
|
||||||
$.each(child, function(i, d) {
|
$.each(child, function(i, d) {
|
||||||
for (var i in selected_items) {
|
for (var i in selected_items) {
|
||||||
if (d.item_code == selected_items[i]) {
|
if (d.item_code == selected_items[i]) {
|
||||||
|
@ -78,7 +78,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
|
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doc.docstatus===0) {
|
if (doc.docstatus===0 && !this.pos_active) {
|
||||||
cur_frm.cscript.sales_order_btn();
|
cur_frm.cscript.sales_order_btn();
|
||||||
cur_frm.cscript.delivery_note_btn();
|
cur_frm.cscript.delivery_note_btn();
|
||||||
}
|
}
|
||||||
|
@ -78,11 +78,6 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
} else {
|
} else {
|
||||||
var btn_label = wn._(this.frm.doctype) + wn._(" View"),
|
var btn_label = wn._(this.frm.doctype) + wn._(" View"),
|
||||||
icon = "icon-file-text";
|
icon = "icon-file-text";
|
||||||
|
|
||||||
|
|
||||||
if (this.frm.doc.docstatus===0) {
|
|
||||||
this.frm.clear_custom_buttons();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user