Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait 2013-10-01 11:23:22 +05:30
commit cde7f829d6
3 changed files with 33 additions and 21 deletions

View File

@ -214,7 +214,7 @@ erpnext.POS = Class.extend({
// if form is local then allow this function // if form is local then allow this function
if (me.frm.doc.docstatus===0) { if (me.frm.doc.docstatus===0) {
$("div.pos-item").on("click", function() { $(me.wrapper).find("div.pos-item").on("click", function() {
if(!me.frm.doc[me.party.toLowerCase()] && ((me.frm.doctype == "Quotation" && if(!me.frm.doc[me.party.toLowerCase()] && ((me.frm.doctype == "Quotation" &&
me.frm.doc.quotation_to == "Customer") me.frm.doc.quotation_to == "Customer")
|| me.frm.doctype != "Quotation")) { || me.frm.doctype != "Quotation")) {
@ -313,7 +313,7 @@ erpnext.POS = Class.extend({
// taxes // taxes
var taxes = wn.model.get_children(this.sales_or_purchase + " Taxes and Charges", var taxes = wn.model.get_children(this.sales_or_purchase + " Taxes and Charges",
this.frm.doc.name, this.frm.cscript.other_fname, this.frm.doctype); this.frm.doc.name, this.frm.cscript.other_fname, this.frm.doctype);
$(".tax-table") $(this.wrapper).find(".tax-table")
.toggle((taxes && taxes.length) ? true : false) .toggle((taxes && taxes.length) ? true : false)
.find("tbody").empty(); .find("tbody").empty();
@ -345,18 +345,18 @@ erpnext.POS = Class.extend({
// if form is local then only run all these functions // if form is local then only run all these functions
if (this.frm.doc.docstatus===0) { if (this.frm.doc.docstatus===0) {
$("input.qty").on("focus", function() { $(this.wrapper).find("input.qty").on("focus", function() {
$(this).select(); $(this).select();
}); });
// append quantity to the respective item after change from input box // append quantity to the respective item after change from input box
$("input.qty").on("change", function() { $(this.wrapper).find("input.qty").on("change", function() {
var item_code = $(this).closest("tr")[0].id; var item_code = $(this).closest("tr")[0].id;
me.update_qty(item_code, $(this).val(), true); me.update_qty(item_code, $(this).val(), true);
}); });
// on td click toggle the highlighting of row // on td click toggle the highlighting of row
me.wrapper.find("#cart tbody tr td").on("click", function() { $(this.wrapper).find("#cart tbody tr td").on("click", function() {
var row = $(this).closest("tr"); var row = $(this).closest("tr");
if (row.attr("data-selected") == "false") { if (row.attr("data-selected") == "false") {
row.attr("class", "warning"); row.attr("class", "warning");
@ -376,16 +376,22 @@ erpnext.POS = Class.extend({
// if form is submitted & cancelled then disable all input box & buttons // if form is submitted & cancelled then disable all input box & buttons
if (this.frm.doc.docstatus>=1) { if (this.frm.doc.docstatus>=1) {
me.wrapper.find('input, button').each(function () { $(this.wrapper).find('input, button').each(function () {
$(this).prop('disabled', true); $(this).prop('disabled', true);
}); });
$(".delete-items").hide(); $(this.wrapper).find(".delete-items").hide();
$(".make-payment").hide(); $(this.wrapper).find(".make-payment").hide();
}
else {
$(this.wrapper).find('input, button').each(function () {
$(this).prop('disabled', false);
});
$(this.wrapper).find(".make-payment").show();
} }
// Show Make Payment button only in Sales Invoice // Show Make Payment button only in Sales Invoice
if (this.frm.doctype != "Sales Invoice") if (this.frm.doctype != "Sales Invoice")
$(".make-payment").hide(); $(this.wrapper).find(".make-payment").hide();
// If quotation to is not Customer then remove party // If quotation to is not Customer then remove party
if (this.frm.doctype == "Quotation") { if (this.frm.doctype == "Quotation") {
@ -395,7 +401,7 @@ erpnext.POS = Class.extend({
} }
}, },
refresh_delete_btn: function() { refresh_delete_btn: function() {
$(".delete-items").toggle($(".item-cart .warning").length ? true : false); $(this.wrapper).find(".delete-items").toggle($(".item-cart .warning").length ? true : false);
}, },
add_item_thru_barcode: function() { add_item_thru_barcode: function() {
var me = this; var me = this;
@ -417,9 +423,9 @@ erpnext.POS = Class.extend({
remove_selected_item: function() { remove_selected_item: function() {
var me = this; var me = this;
var selected_items = []; var selected_items = [];
var no_of_items = me.wrapper.find("#cart tbody tr").length; var no_of_items = $(this.wrapper).find("#cart tbody tr").length;
for(var x=0; x<=no_of_items - 1; x++) { for(var x=0; x<=no_of_items - 1; x++) {
var row = me.wrapper.find("#cart tbody tr:eq(" + x + ")"); var row = $(this.wrapper).find("#cart tbody tr:eq(" + x + ")");
if(row.attr("data-selected") == "true") { if(row.attr("data-selected") == "true") {
selected_items.push(row.attr("id")); selected_items.push(row.attr("id"));
} }
@ -442,7 +448,7 @@ erpnext.POS = Class.extend({
}, },
make_payment: function() { make_payment: function() {
var me = this; var me = this;
var no_of_items = me.wrapper.find("#cart tbody tr").length; var no_of_items = $(this.wrapper).find("#cart tbody tr").length;
var mode_of_payment = []; var mode_of_payment = [];
if (no_of_items == 0) if (no_of_items == 0)

View File

@ -93,9 +93,14 @@ wn.ui.form.TableGrid = Class.extend({
// Make other headers with label as heading // Make other headers with label as heading
$.each(this.fields, function(i, obj) { $.each(this.fields, function(i, obj) {
if (obj.in_list_view===1)
var th = document.createElement("th"); var th = document.createElement("th");
// If currency then move header to right
if (obj.fieldtype == "Currency")
$(th).attr("style", "vertical-align:middle; text-align:right;");
else
$(th).attr("style", "vertical-align:middle"); $(th).attr("style", "vertical-align:middle");
$(th).html(obj.label); $(th).html(obj.label);
$(th).appendTo(row); $(th).appendTo(row);
}); });
@ -164,7 +169,7 @@ wn.ui.form.TableGrid = Class.extend({
if (row) if (row)
this.dialog.set_values(this.make_dialog_values(row)); this.dialog.set_values(this.make_dialog_values(row));
$a(this.dialog.body, 'div', '', '', this.make_dialog_buttons()); $a(this.dialog.body, 'div', '', '', this.make_dialog_buttons(row));
this.dialog.show(); this.dialog.show();
this.dialog.$wrapper.find('button.update').on('click', function() { this.dialog.$wrapper.find('button.update').on('click', function() {
@ -186,12 +191,12 @@ wn.ui.form.TableGrid = Class.extend({
return dialog_values; return dialog_values;
}, },
make_dialog_buttons: function() { make_dialog_buttons: function(row) {
var me = this; var me = this;
var buttons = '<button class="btn btn-primary update">Update</button>'; var buttons = '<button class="btn btn-primary update">Update</button>';
// if user can delete then only add the delete button in dialog // if user can delete then only add the delete button in dialog
if (wn.model.can_delete(me.frm.doc.doctype)) if (wn.model.can_delete(me.frm.doc.doctype) && row)
buttons += ' <button class="btn btn-default delete">Delete</button>'; buttons += ' <button class="btn btn-default delete">Delete</button>';
return buttons; return buttons;

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-25 11:35:09", "creation": "2013-01-25 11:35:09",
"docstatus": 0, "docstatus": 0,
"modified": "2013-09-06 15:03:38", "modified": "2013-09-30 15:50:52",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -85,6 +85,7 @@
"reqd": 1 "reqd": 1
}, },
{ {
"description": "To change row values, click on the respective row",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "item_prices_section", "fieldname": "item_prices_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",