fix: In-Transit Feature enhancements (#24652)
This commit is contained in:
parent
ec829786e9
commit
832098f042
@ -725,7 +725,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "default_in_transit_warehouse",
|
"fieldname": "default_in_transit_warehouse",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Default In Transit Warehouse",
|
"label": "Default In-Transit Warehouse",
|
||||||
"options": "Warehouse"
|
"options": "Warehouse"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -740,7 +740,7 @@
|
|||||||
"image_field": "company_logo",
|
"image_field": "company_logo",
|
||||||
"is_tree": 1,
|
"is_tree": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-12-03 12:27:27.085094",
|
"modified": "2021-02-16 15:53:37.167589",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"name": "Company",
|
"name": "Company",
|
||||||
|
@ -591,6 +591,7 @@ frappe.ui.form.on('Stock Entry', {
|
|||||||
|
|
||||||
add_to_transit: function(frm) {
|
add_to_transit: function(frm) {
|
||||||
if(frm.doc.add_to_transit && frm.doc.purpose=='Material Transfer') {
|
if(frm.doc.add_to_transit && frm.doc.purpose=='Material Transfer') {
|
||||||
|
frm.set_value('to_warehouse', '');
|
||||||
frm.set_value('stock_entry_type', 'Material Transfer');
|
frm.set_value('stock_entry_type', 'Material Transfer');
|
||||||
frm.fields_dict.to_warehouse.get_query = function() {
|
frm.fields_dict.to_warehouse.get_query = function() {
|
||||||
return {
|
return {
|
||||||
@ -601,7 +602,15 @@ frappe.ui.form.on('Stock Entry', {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
frappe.db.get_value('Company', frm.doc.company, 'default_in_transit_warehouse', (r) => {
|
frm.trigger('set_tansit_warehouse');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
set_tansit_warehouse: function(frm) {
|
||||||
|
if(frm.doc.add_to_transit && frm.doc.purpose == 'Material Transfer' && !frm.doc.to_warehouse) {
|
||||||
|
let dt = frm.doc.from_warehouse ? 'Warehouse' : 'Company';
|
||||||
|
let dn = frm.doc.from_warehouse ? frm.doc.from_warehouse : frm.doc.company;
|
||||||
|
frappe.db.get_value(dt, dn, 'default_in_transit_warehouse', (r) => {
|
||||||
if (r.default_in_transit_warehouse) {
|
if (r.default_in_transit_warehouse) {
|
||||||
frm.set_value('to_warehouse', r.default_in_transit_warehouse);
|
frm.set_value('to_warehouse', r.default_in_transit_warehouse);
|
||||||
}
|
}
|
||||||
@ -968,6 +977,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
from_warehouse: function(doc) {
|
from_warehouse: function(doc) {
|
||||||
|
this.frm.trigger('set_tansit_warehouse');
|
||||||
this.set_warehouse_in_children(doc.items, "s_warehouse", doc.from_warehouse);
|
this.set_warehouse_in_children(doc.items, "s_warehouse", doc.from_warehouse);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -3,6 +3,18 @@
|
|||||||
|
|
||||||
|
|
||||||
frappe.ui.form.on("Warehouse", {
|
frappe.ui.form.on("Warehouse", {
|
||||||
|
onload: function(frm) {
|
||||||
|
frm.set_query("default_in_transit_warehouse", function() {
|
||||||
|
return {
|
||||||
|
filters:{
|
||||||
|
'warehouse_type' : 'Transit',
|
||||||
|
'is_group': 0,
|
||||||
|
'company': frm.doc.company
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.toggle_display('warehouse_name', frm.doc.__islocal);
|
frm.toggle_display('warehouse_name', frm.doc.__islocal);
|
||||||
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
|
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"column_break_3",
|
"column_break_3",
|
||||||
"warehouse_type",
|
"warehouse_type",
|
||||||
"parent_warehouse",
|
"parent_warehouse",
|
||||||
|
"default_in_transit_warehouse",
|
||||||
"is_group",
|
"is_group",
|
||||||
"column_break_4",
|
"column_break_4",
|
||||||
"account",
|
"account",
|
||||||
@ -230,13 +231,20 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "column_break_3",
|
"fieldname": "column_break_3",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "eval: doc.warehouse_type !== 'Transit';",
|
||||||
|
"fieldname": "default_in_transit_warehouse",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Default In-Transit Warehouse",
|
||||||
|
"options": "Warehouse"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-building",
|
"icon": "fa fa-building",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_tree": 1,
|
"is_tree": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-08-03 18:41:52.442502",
|
"modified": "2021-02-16 17:21:52.380098",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Warehouse",
|
"name": "Warehouse",
|
||||||
|
Loading…
Reference in New Issue
Block a user