fix: serial no refresh issue (#25127)
* fix: serial no refresh issue * fix: sider
This commit is contained in:
parent
f9fde054e1
commit
d9fa79de99
@ -737,28 +737,34 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
this.frm.trigger("item_code", cdt, cdn);
|
||||
}
|
||||
else {
|
||||
var valid_serial_nos = [];
|
||||
var serialnos = [];
|
||||
// Replacing all occurences of comma with carriage return
|
||||
item.serial_no = item.serial_no.replace(/,/g, '\n');
|
||||
serialnos = item.serial_no.split("\n");
|
||||
for (var i = 0; i < serialnos.length; i++) {
|
||||
if (serialnos[i] != "") {
|
||||
valid_serial_nos.push(serialnos[i]);
|
||||
}
|
||||
}
|
||||
item.conversion_factor = item.conversion_factor || 1;
|
||||
|
||||
refresh_field("serial_no", item.name, item.parentfield);
|
||||
if(!doc.is_return && cint(user_defaults.set_qty_in_transactions_based_on_serial_no_input)) {
|
||||
frappe.model.set_value(item.doctype, item.name,
|
||||
"qty", valid_serial_nos.length / item.conversion_factor);
|
||||
frappe.model.set_value(item.doctype, item.name, "stock_qty", valid_serial_nos.length);
|
||||
if (!doc.is_return && cint(frappe.user_defaults.set_qty_in_transactions_based_on_serial_no_input)) {
|
||||
setTimeout(() => {
|
||||
me.update_qty(cdt, cdn);
|
||||
}, 10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
update_qty: function(cdt, cdn) {
|
||||
var valid_serial_nos = [];
|
||||
var serialnos = [];
|
||||
var item = frappe.get_doc(cdt, cdn);
|
||||
serialnos = item.serial_no.split("\n");
|
||||
for (var i = 0; i < serialnos.length; i++) {
|
||||
if (serialnos[i] != "") {
|
||||
valid_serial_nos.push(serialnos[i]);
|
||||
}
|
||||
}
|
||||
frappe.model.set_value(item.doctype, item.name,
|
||||
"qty", valid_serial_nos.length / item.conversion_factor);
|
||||
frappe.model.set_value(item.doctype, item.name, "stock_qty", valid_serial_nos.length);
|
||||
},
|
||||
|
||||
validate: function() {
|
||||
this.calculate_taxes_and_totals(false);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user