mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-15 09:53:09 +00:00
fix: set batch created from bundle to batch field in stock transaction (#39966)
* fix: set batch created from bundle to batch field in stock transaction
* fix: validation for serial and batch no
(cherry picked from commit 4b24fcd221)
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -368,6 +368,7 @@ erpnext.buying = {
|
||||
|
||||
let update_values = {
|
||||
"serial_and_batch_bundle": r.name,
|
||||
"use_serial_batch_fields": 0,
|
||||
"qty": qty / flt(item.conversion_factor || 1, precision("conversion_factor", item))
|
||||
}
|
||||
|
||||
@@ -408,6 +409,7 @@ erpnext.buying = {
|
||||
|
||||
let update_values = {
|
||||
"serial_and_batch_bundle": r.name,
|
||||
"use_serial_batch_fields": 0,
|
||||
"rejected_qty": qty / flt(item.conversion_factor || 1, precision("conversion_factor", item))
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +145,12 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
});
|
||||
}
|
||||
|
||||
if(this.frm.fields_dict['items'].grid.get_field('batch_no')) {
|
||||
this.frm.set_query('batch_no', 'items', function(doc, cdt, cdn) {
|
||||
return me.set_query_for_batch(doc, cdt, cdn);
|
||||
});
|
||||
}
|
||||
|
||||
if(
|
||||
this.frm.docstatus < 2
|
||||
&& this.frm.fields_dict["payment_terms_template"]
|
||||
@@ -1633,18 +1639,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
return item_list;
|
||||
}
|
||||
|
||||
items_delete() {
|
||||
this.update_localstorage_scanned_data();
|
||||
}
|
||||
|
||||
update_localstorage_scanned_data() {
|
||||
let doctypes = ["Sales Invoice", "Purchase Invoice", "Delivery Note", "Purchase Receipt"];
|
||||
if (this.frm.is_new() && doctypes.includes(this.frm.doc.doctype)) {
|
||||
const barcode_scanner = new erpnext.utils.BarcodeScanner({frm:this.frm});
|
||||
barcode_scanner.update_localstorage_scanned_data();
|
||||
}
|
||||
}
|
||||
|
||||
_set_values_for_item_list(children) {
|
||||
const items_rule_dict = {};
|
||||
|
||||
|
||||
@@ -339,6 +339,7 @@ erpnext.sales_common = {
|
||||
|
||||
frappe.model.set_value(item.doctype, item.name, {
|
||||
"serial_and_batch_bundle": r.name,
|
||||
"use_serial_batch_fields": 0,
|
||||
"qty": qty / flt(item.conversion_factor || 1, precision("conversion_factor", item))
|
||||
});
|
||||
}
|
||||
|
||||
@@ -71,6 +71,10 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate {
|
||||
let warehouse = this.item?.type_of_transaction === "Outward" ?
|
||||
(this.item.warehouse || this.item.s_warehouse) : "";
|
||||
|
||||
if (this.frm.doc.doctype === 'Stock Entry') {
|
||||
warehouse = this.item.s_warehouse || this.item.t_warehouse;
|
||||
}
|
||||
|
||||
if (!warehouse && this.frm.doc.doctype === 'Stock Reconciliation') {
|
||||
warehouse = this.get_warehouse();
|
||||
}
|
||||
@@ -367,19 +371,11 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate {
|
||||
label: __('Batch No'),
|
||||
in_list_view: 1,
|
||||
get_query: () => {
|
||||
if (this.item.type_of_transaction !== "Outward") {
|
||||
return {
|
||||
filters: {
|
||||
'item': this.item.item_code,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
query : "erpnext.controllers.queries.get_batch_no",
|
||||
filters: {
|
||||
'item_code': this.item.item_code,
|
||||
'warehouse': this.get_warehouse()
|
||||
}
|
||||
return {
|
||||
query : "erpnext.controllers.queries.get_batch_no",
|
||||
filters: {
|
||||
'item_code': this.item.item_code,
|
||||
'warehouse': this.item.s_warehouse || this.item.t_warehouse,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user