fix: pull serial numbers linked to batches + pull warehouse correctly (develop) (#19022)
* fix: pull serial numbers according to set warehouses * fix: handle purchase returns
This commit is contained in:
parent
df3b4e48fe
commit
7372672044
@ -1808,14 +1808,44 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
}
|
||||
});
|
||||
|
||||
erpnext.show_serial_batch_selector = function(frm, d, callback, on_close, show_dialog) {
|
||||
erpnext.show_serial_batch_selector = function (frm, d, callback, on_close, show_dialog) {
|
||||
let warehouse, receiving_stock, existing_stock;
|
||||
if (frm.doc.is_return) {
|
||||
if (["Purchase Receipt", "Purchase Invoice"].includes(frm.doc.doctype)) {
|
||||
existing_stock = true;
|
||||
warehouse = d.warehouse;
|
||||
} else if (["Delivery Note", "Sales Invoice"].includes(frm.doc.doctype)) {
|
||||
receiving_stock = true;
|
||||
}
|
||||
} else {
|
||||
if (frm.doc.doctype == "Stock Entry") {
|
||||
if (frm.doc.purpose == "Material Receipt") {
|
||||
receiving_stock = true;
|
||||
} else {
|
||||
existing_stock = true;
|
||||
warehouse = d.s_warehouse;
|
||||
}
|
||||
} else {
|
||||
existing_stock = true;
|
||||
warehouse = d.warehouse;
|
||||
}
|
||||
}
|
||||
|
||||
if (!warehouse) {
|
||||
if (receiving_stock) {
|
||||
warehouse = ["like", ""];
|
||||
} else if (existing_stock) {
|
||||
warehouse = ["!=", ""];
|
||||
}
|
||||
}
|
||||
|
||||
frappe.require("assets/erpnext/js/utils/serial_no_batch_selector.js", function() {
|
||||
new erpnext.SerialNoBatchSelector({
|
||||
frm: frm,
|
||||
item: d,
|
||||
warehouse_details: {
|
||||
type: "Warehouse",
|
||||
name: d.warehouse
|
||||
name: warehouse
|
||||
},
|
||||
callback: callback,
|
||||
on_close: on_close
|
||||
|
@ -389,12 +389,14 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
|
||||
let serial_no_filters = {
|
||||
item_code: me.item_code,
|
||||
batch_no: this.doc.batch_no || null,
|
||||
delivery_document_no: ""
|
||||
}
|
||||
|
||||
if (me.warehouse_details.name) {
|
||||
serial_no_filters['warehouse'] = me.warehouse_details.name;
|
||||
}
|
||||
|
||||
return [
|
||||
{fieldtype: 'Section Break', label: __('Serial Numbers')},
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user