refactor: added new file serial batch bundle
diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js
index e37a9b7..2a81651 100644
--- a/erpnext/public/js/controllers/buying.js
+++ b/erpnext/public/js/controllers/buying.js
@@ -346,7 +346,7 @@
}
}
- update_serial_batch_bundle(doc, cdt, cdn) {
+ add_serial_batch_bundle(doc, cdt, cdn) {
let item = locals[cdt][cdn];
let me = this;
let path = "assets/erpnext/js/utils/serial_no_batch_selector.js";
@@ -356,6 +356,8 @@
if (r.message && (r.message.has_batch_no || r.message.has_serial_no)) {
item.has_serial_no = r.message.has_serial_no;
item.has_batch_no = r.message.has_batch_no;
+ item.type_of_transaction = item.qty > 0 ? "Inward" : "Outward";
+ item.is_rejected = false;
frappe.require(path, function() {
new erpnext.SerialNoBatchBundleUpdate(
@@ -371,6 +373,34 @@
}
});
}
+
+ add_serial_batch_for_rejected_qty(doc, cdt, cdn) {
+ let item = locals[cdt][cdn];
+ let me = this;
+ let path = "assets/erpnext/js/utils/serial_no_batch_selector.js";
+
+ frappe.db.get_value("Item", item.item_code, ["has_batch_no", "has_serial_no"])
+ .then((r) => {
+ if (r.message && (r.message.has_batch_no || r.message.has_serial_no)) {
+ item.has_serial_no = r.message.has_serial_no;
+ item.has_batch_no = r.message.has_batch_no;
+ item.type_of_transaction = item.qty > 0 ? "Inward" : "Outward";
+ item.is_rejected = true;
+
+ frappe.require(path, function() {
+ new erpnext.SerialNoBatchBundleUpdate(
+ me.frm, item, (r) => {
+ if (r) {
+ me.frm.refresh_fields();
+ frappe.model.set_value(cdt, cdn,
+ "rejected_serial_and_batch_bundle", r.name);
+ }
+ }
+ );
+ });
+ }
+ });
+ }
};
cur_frm.add_fetch('project', 'cost_center', 'cost_center');