[fix] fixes in purchase common

This commit is contained in:
Rushabh Mehta 2013-06-14 14:27:53 +05:30
parent 37982a6a1f
commit 466298b6e7

View File

@ -225,8 +225,9 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
if(this.frm.doc.doctype != "Purchase Invoice") { if(this.frm.doc.doctype != "Purchase Invoice") {
// hack! // hack!
wn.meta.docfield_copy[this.tname][this.frm.doc.name]["rate"] = $.extend({}, var purchase_rate_df = wn.meta.get_docfield(this.tname, "rate", this.frm.doc.name);
wn.meta.docfield_copy[this.tname][this.frm.doc.name]["purchase_rate"]); wn.meta.docfield_copy[this.tname][this.frm.doc.name]["rate"] =
$.extend({}, purchase_rate_df);
} }
$.each(this.frm.item_doclist, function(i, item) { $.each(this.frm.item_doclist, function(i, item) {
@ -310,10 +311,12 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}); });
} }
if(!wn.meta.get_docfield(item.doctype, "item_tax_amount", item.parent || item.name)) { if(this.frm.item_doclist.length) {
$.each(this.frm.item_doclist, function(i, item) { if(!wn.meta.get_docfield(this.frm.item_doclist[0].doctype, "item_tax_amount", this.frm.doctype)) {
delete item["item_tax_amount"]; $.each(this.frm.item_doclist, function(i, item) {
}); delete item["item_tax_amount"];
});
}
} }
}, },