[item price] item price made as an individual master and removed from price list

This commit is contained in:
Akhilesh Darjee
2013-10-18 14:24:21 +05:30
parent 04638a5f77
commit fcd70d04f3
22 changed files with 312 additions and 364 deletions

View File

@@ -114,6 +114,40 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
this.frm.refresh();
}
},
serial_no: function(doc, cdt, cdn) {
var me = this;
var item = wn.model.get_doc(cdt, cdn);
if (item.serial_no) {
if (!item.item_code) {
this.frm.script_manager.trigger("item_code", cdt, cdn);
}
else {
var sr_no = [];
// Replacing all occurences of comma with carriage return
var serial_nos = item.serial_no.trim().replace(/,/g, '\n');
serial_nos = serial_nos.trim().split('\n');
// Trim each string and push unique string to new list
for (var x=0; x<=serial_nos.length - 1; x++) {
if (serial_nos[x].trim() != "" && sr_no.indexOf(serial_nos[x].trim()) == -1) {
sr_no.push(serial_nos[x].trim());
}
}
// Add the new list to the serial no. field in grid with each in new line
item.serial_no = "";
for (var x=0; x<=sr_no.length - 1; x++)
item.serial_no += sr_no[x] + '\n';
refresh_field("serial_no", item.name, item.parentfield);
wn.model.set_value(item.doctype, item.name, "qty", sr_no.length);
}
}
},
validate: function() {
this.calculate_taxes_and_totals();