fix: serial and batch bundle return not working (#38754)
* fix: serial and batch bundle return not working
* test: added test case for delivery note return against denormalized serial no
diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js
index 3ed7fc7..77ecf75 100644
--- a/erpnext/public/js/controllers/buying.js
+++ b/erpnext/public/js/controllers/buying.js
@@ -361,9 +361,14 @@
new erpnext.SerialBatchPackageSelector(
me.frm, item, (r) => {
if (r) {
+ let qty = Math.abs(r.total_qty);
+ if (doc.is_return) {
+ qty = qty * -1;
+ }
+
let update_values = {
"serial_and_batch_bundle": r.name,
- "qty": Math.abs(r.total_qty)
+ "qty": qty
}
if (r.warehouse) {
@@ -396,9 +401,14 @@
new erpnext.SerialBatchPackageSelector(
me.frm, item, (r) => {
if (r) {
+ let qty = Math.abs(r.total_qty);
+ if (doc.is_return) {
+ qty = qty * -1;
+ }
+
let update_values = {
"serial_and_batch_bundle": r.name,
- "rejected_qty": Math.abs(r.total_qty)
+ "rejected_qty": qty
}
if (r.warehouse) {