mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
default target warehouse for subcontract
This commit is contained in:
@@ -24,6 +24,12 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.frm.fields_dict.bom_no.get_query = function() {
|
||||||
|
return {
|
||||||
|
filters:{ 'docstatus': 1 }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
this.frm.fields_dict.mtn_details.grid.get_field('item_code').get_query = function() {
|
this.frm.fields_dict.mtn_details.grid.get_field('item_code').get_query = function() {
|
||||||
if(in_list(["Sales Return", "Purchase Return"], me.frm.doc.purpose) &&
|
if(in_list(["Sales Return", "Purchase Return"], me.frm.doc.purpose) &&
|
||||||
me.get_doctype_docname()) {
|
me.get_doctype_docname()) {
|
||||||
|
|||||||
@@ -237,11 +237,6 @@
|
|||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "fold",
|
|
||||||
"fieldtype": "Fold",
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"depends_on": "eval:(doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")",
|
"depends_on": "eval:(doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")",
|
||||||
"fieldname": "sb1",
|
"fieldname": "sb1",
|
||||||
@@ -339,6 +334,11 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0
|
"search_index": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "fold",
|
||||||
|
"fieldtype": "Fold",
|
||||||
|
"permlevel": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "eval:(doc.purpose==\"Sales Return\" || doc.purpose==\"Purchase Return\")",
|
"depends_on": "eval:(doc.purpose==\"Sales Return\" || doc.purpose==\"Purchase Return\")",
|
||||||
"fieldname": "contact_section",
|
"fieldname": "contact_section",
|
||||||
@@ -585,7 +585,7 @@
|
|||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2014-09-16 15:56:37.514676",
|
"modified": "2015-01-29 11:26:46.968041",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Stock Entry",
|
"name": "Stock Entry",
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ class StockEntry(StockController):
|
|||||||
def validate_warehouse(self, pro_obj):
|
def validate_warehouse(self, pro_obj):
|
||||||
"""perform various (sometimes conditional) validations on warehouse"""
|
"""perform various (sometimes conditional) validations on warehouse"""
|
||||||
|
|
||||||
source_mandatory = ["Material Issue", "Material Transfer", "Purchase Return"]
|
source_mandatory = ["Material Issue", "Material Transfer", "Purchase Return", "Subcontract"]
|
||||||
target_mandatory = ["Material Receipt", "Material Transfer", "Sales Return"]
|
target_mandatory = ["Material Receipt", "Material Transfer", "Sales Return", "Subcontract"]
|
||||||
|
|
||||||
validate_for_manufacture_repack = any([d.bom_no for d in self.get("mtn_details")])
|
validate_for_manufacture_repack = any([d.bom_no for d in self.get("mtn_details")])
|
||||||
|
|
||||||
@@ -467,6 +467,9 @@ class StockEntry(StockController):
|
|||||||
"Subcontract"]:
|
"Subcontract"]:
|
||||||
if self.production_order and self.purpose == "Material Transfer":
|
if self.production_order and self.purpose == "Material Transfer":
|
||||||
item_dict = self.get_pending_raw_materials(pro_obj)
|
item_dict = self.get_pending_raw_materials(pro_obj)
|
||||||
|
if self.to_warehouse and pro_obj:
|
||||||
|
for item in item_dict.values():
|
||||||
|
item["to_warehouse"] = pro_obj.wip_warehouse
|
||||||
else:
|
else:
|
||||||
if not self.fg_completed_qty:
|
if not self.fg_completed_qty:
|
||||||
frappe.throw(_("Manufacturing Quantity is mandatory"))
|
frappe.throw(_("Manufacturing Quantity is mandatory"))
|
||||||
@@ -474,7 +477,8 @@ class StockEntry(StockController):
|
|||||||
for item in item_dict.values():
|
for item in item_dict.values():
|
||||||
if pro_obj:
|
if pro_obj:
|
||||||
item["from_warehouse"] = pro_obj.wip_warehouse
|
item["from_warehouse"] = pro_obj.wip_warehouse
|
||||||
item["to_warehouse"] = ""
|
|
||||||
|
item["to_warehouse"] = self.to_warehouse if self.purpose=="Subcontract" else ""
|
||||||
|
|
||||||
# add raw materials to Stock Entry Detail table
|
# add raw materials to Stock Entry Detail table
|
||||||
self.add_to_stock_entry_detail(item_dict)
|
self.add_to_stock_entry_detail(item_dict)
|
||||||
@@ -525,7 +529,7 @@ class StockEntry(StockController):
|
|||||||
item_dict = get_bom_items_as_dict(self.bom_no, qty=qty, fetch_exploded = self.use_multi_level_bom)
|
item_dict = get_bom_items_as_dict(self.bom_no, qty=qty, fetch_exploded = self.use_multi_level_bom)
|
||||||
|
|
||||||
for item in item_dict.values():
|
for item in item_dict.values():
|
||||||
item.from_warehouse = item.default_warehouse
|
item.from_warehouse = self.from_warehouse or item.default_warehouse
|
||||||
|
|
||||||
return item_dict
|
return item_dict
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user