Merge pull request #25776 from rohitwaghchaure/fixed-warehouse-not-found-issue

fix: warehouse not found in stock entry
This commit is contained in:
rohitwaghchaure 2021-05-24 17:00:06 +05:30 committed by GitHub
commit 6809ff4f64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 9 deletions

View File

@ -600,7 +600,6 @@ frappe.ui.form.on('Stock Entry', {
add_to_transit: function(frm) {
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.fields_dict.to_warehouse.get_query = function() {
return {
filters:{
@ -610,12 +609,13 @@ frappe.ui.form.on('Stock Entry', {
}
};
};
frm.trigger('set_tansit_warehouse');
frm.trigger('set_transit_warehouse');
}
},
set_tansit_warehouse: function(frm) {
if(frm.doc.add_to_transit && frm.doc.purpose == 'Material Transfer' && !frm.doc.to_warehouse) {
set_transit_warehouse: function(frm) {
if(frm.doc.add_to_transit && frm.doc.purpose == 'Material Transfer' && !frm.doc.to_warehouse
&& frm.doc.from_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) => {
@ -985,7 +985,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
},
from_warehouse: function(doc) {
this.frm.trigger('set_tansit_warehouse');
this.frm.trigger('set_transit_warehouse');
this.set_warehouse_in_children(doc.items, "s_warehouse", doc.from_warehouse);
},

View File

@ -637,6 +637,8 @@
{
"default": "0",
"depends_on": "eval: doc.purpose=='Material Transfer' && !doc.outgoing_stock_entry",
"fetch_from": "stock_entry_type.add_to_transit",
"fetch_if_empty": 1,
"fieldname": "add_to_transit",
"fieldtype": "Check",
"label": "Add to Transit",
@ -655,7 +657,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2020-12-09 14:58:13.267321",
"modified": "2021-05-21 11:29:11.917161",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry",

View File

@ -6,7 +6,8 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"purpose"
"purpose",
"add_to_transit"
],
"fields": [
{
@ -18,10 +19,17 @@
"options": "\nMaterial Issue\nMaterial Receipt\nMaterial Transfer\nMaterial Transfer for Manufacture\nMaterial Consumption for Manufacture\nManufacture\nRepack\nSend to Subcontractor",
"reqd": 1,
"set_only_once": 1
},
{
"default": "0",
"depends_on": "eval: doc.purpose == 'Material Transfer'",
"fieldname": "add_to_transit",
"fieldtype": "Check",
"label": "Add to Transit"
}
],
"links": [],
"modified": "2020-08-10 23:24:37.160817",
"modified": "2021-05-21 11:27:01.144110",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Type",

View File

@ -7,4 +7,6 @@ from __future__ import unicode_literals
from frappe.model.document import Document
class StockEntryType(Document):
pass
def validate(self):
if self.add_to_transit and self.purpose != 'Material Transfer':
self.add_to_transit = 0