renamed purpose in stock entry

This commit is contained in:
Rohit Waghchaure 2019-03-26 12:03:20 +05:30
parent c7b916ac46
commit ffbeb02428
8 changed files with 47 additions and 38 deletions

View File

@ -19,7 +19,7 @@ def create_stock_entry_types():
for purpose in ["Material Issue", "Material Receipt", "Material Transfer",
"Material Transfer for Manufacture", "Material Consumption for Manufacture", "Manufacture",
"Repack", "Subcontract", "Stock Out", "Stock In"]:
"Repack", "Subcontract", "Send to Warehouse", "Receive at Warehouse"]:
ste_type = frappe.get_doc({
'doctype': 'Stock Entry Type',

View File

@ -92,8 +92,8 @@ def install(country=None):
{'doctype': 'Stock Entry Type', 'name': 'Subcontract', 'purpose': 'Subcontract'},
{'doctype': 'Stock Entry Type', 'name': 'Material Transfer for Manufacture', 'purpose': 'Material Transfer for Manufacture'},
{'doctype': 'Stock Entry Type', 'name': 'Material Consumption for Manufacture', 'purpose': 'Material Consumption for Manufacture'},
{'doctype': 'Stock Entry Type', 'name': 'Stock Out', 'purpose': 'Stock Out'},
{'doctype': 'Stock Entry Type', 'name': 'Stock In', 'purpose': 'Stock In'},
{'doctype': 'Stock Entry Type', 'name': 'Send to Warehouse', 'purpose': 'Send to Warehouse'},
{'doctype': 'Stock Entry Type', 'name': 'Receive at Warehouse', 'purpose': 'Receive at Warehouse'},
# Designation
{'doctype': 'Designation', 'designation_name': _('CEO')},

View File

@ -14,12 +14,12 @@ frappe.ui.form.on('Stock Entry', {
}
});
frm.set_query('outward_stock_entry', function() {
frm.set_query('outgoing_stock_entry', function() {
return {
filters: [
['Stock Entry', 'docstatus', '=', 1],
['Stock Entry', 'per_transferred', '<','100'],
['Stock Entry', 'purpose', '=', 'Stock Out']
['Stock Entry', 'purpose', '=', 'Send to Warehouse']
]
}
});
@ -102,7 +102,7 @@ frappe.ui.form.on('Stock Entry', {
});
},
outward_stock_entry: function(frm) {
outgoing_stock_entry: function(frm) {
frappe.call({
doc: frm.doc,
method: "set_items_for_stock_in",
@ -159,14 +159,26 @@ frappe.ui.form.on('Stock Entry', {
}
}
if (frm.doc.docstatus === 1
&& frm.doc.purpose == 'Stock Out') {
frm.add_custom_button(__('Make Stock In Entry'), function() {
frappe.model.open_mapped_doc({
method: "erpnext.stock.doctype.stock_entry.stock_entry.make_stock_in_entry",
frm: frm
})
});
if (frm.doc.docstatus === 1 && frm.doc.purpose == 'Send to Warehouse') {
if (frm.doc.per_transferred < 100) {
frm.add_custom_button(__('Receive at Warehouse Entry'), function() {
frappe.model.open_mapped_doc({
method: "erpnext.stock.doctype.stock_entry.stock_entry.make_stock_in_entry",
frm: frm
})
});
}
if (frm.doc.per_transferred > 0) {
frm.add_custom_button(__('Received Stock Entries'), function() {
frappe.route_options = {
'outgoing_stock_entry': frm.doc.name,
'docstatus': ['!=', 2]
};
frappe.set_route('List', 'Stock Entry');
}, __("View"));
}
}
if (frm.doc.docstatus===0) {
@ -770,9 +782,9 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
},
source_mandatory: ["Material Issue", "Material Transfer", "Subcontract",
"Material Transfer for Manufacture", "Stock Out", "Stock In"],
"Material Transfer for Manufacture", "Send to Warehouse", "Receive at Warehouse"],
target_mandatory: ["Material Receipt", "Material Transfer", "Subcontract",
"Material Transfer for Manufacture", "Stock Out", "Stock In"],
"Material Transfer for Manufacture", "Send to Warehouse", "Receive at Warehouse"],
from_warehouse: function(doc) {
var me = this;
@ -837,8 +849,8 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
doc.purpose!='Material Issue');
this.frm.fields_dict["items"].grid.set_column_disp("additional_cost", doc.purpose!='Material Issue');
this.frm.toggle_reqd("outward_stock_entry",
doc.purpose == 'Stock In' ? 1: 0);
this.frm.toggle_reqd("outgoing_stock_entry",
doc.purpose == 'Receive at Warehouse' ? 1: 0);
},
supplier: function(doc) {

View File

@ -158,9 +158,9 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.purpose == 'Stock In'",
"depends_on": "eval:doc.purpose == 'Receive at Warehouse'",
"fetch_if_empty": 0,
"fieldname": "outward_stock_entry",
"fieldname": "outgoing_stock_entry",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
@ -210,7 +210,7 @@
"no_copy": 0,
"oldfieldname": "purpose",
"oldfieldtype": "Select",
"options": "Material Issue\nMaterial Receipt\nMaterial Transfer\nMaterial Transfer for Manufacture\nMaterial Consumption for Manufacture\nManufacture\nRepack\nSubcontract\nStock Out\nStock In",
"options": "Material Issue\nMaterial Receipt\nMaterial Transfer\nMaterial Transfer for Manufacture\nMaterial Consumption for Manufacture\nManufacture\nRepack\nSubcontract\nSend to Warehouse\nReceive at Warehouse",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -2238,17 +2238,15 @@
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "fa fa-file-text",
"idx": 1,
"image_view": 0,
"in_create": 0,
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2019-03-14 16:18:08.665492",
"modified": "2019-03-26 12:02:19.319467",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry",
@ -2333,7 +2331,6 @@
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "posting_date, from_warehouse, to_warehouse, purpose, remarks",
"show_name_in_global_search": 1,
"sort_field": "modified",

View File

@ -124,7 +124,7 @@ class StockEntry(StockController):
def validate_purpose(self):
valid_purposes = ["Material Issue", "Material Receipt", "Material Transfer",
"Material Transfer for Manufacture", "Manufacture", "Repack", "Subcontract",
"Material Consumption for Manufacture", "Stock Out", "Stock In"]
"Material Consumption for Manufacture", "Send to Warehouse", "Receive at Warehouse"]
if self.purpose not in valid_purposes:
frappe.throw(_("Purpose must be one of {0}").format(comma_or(valid_purposes)))
@ -228,10 +228,10 @@ class StockEntry(StockController):
"""perform various (sometimes conditional) validations on warehouse"""
source_mandatory = ["Material Issue", "Material Transfer", "Subcontract", "Material Transfer for Manufacture",
"Material Consumption for Manufacture", "Stock Out", "Stock In"]
"Material Consumption for Manufacture", "Send to Warehouse", "Receive at Warehouse"]
target_mandatory = ["Material Receipt", "Material Transfer", "Subcontract",
"Material Transfer for Manufacture", "Stock Out", "Stock In"]
"Material Transfer for Manufacture", "Send to Warehouse", "Receive at Warehouse"]
validate_for_manufacture_repack = any([d.bom_no for d in self.get("items")])
@ -705,8 +705,8 @@ class StockEntry(StockController):
def set_items_for_stock_in(self):
self.items = []
if self.outward_stock_entry and self.purpose == 'Stock In':
doc = frappe.get_doc('Stock Entry', self.outward_stock_entry)
if self.outgoing_stock_entry and self.purpose == 'Receive at Warehouse':
doc = frappe.get_doc('Stock Entry', self.outgoing_stock_entry)
if doc.per_transferred == 100:
frappe.throw(_("Goods are already received against the outward entry {0}")
@ -1173,7 +1173,7 @@ class StockEntry(StockController):
to fullfill Sales Order {2}.").format(item.item_code, sr, sales_order))
def update_transferred_qty(self):
if self.purpose == 'Stock In':
if self.purpose == 'Receive at Warehouse':
stock_entries = {}
stock_entries_child_list = []
for d in self.items:
@ -1257,7 +1257,7 @@ def move_sample_to_retention_warehouse(company, items):
@frappe.whitelist()
def make_stock_in_entry(source_name, target_doc=None):
def set_missing_values(source, target):
target.purpose = 'Stock In'
target.purpose = 'Receive at Warehouse'
target.set_stock_entry_type()
def update_item(source_doc, target_doc, source_parent):
@ -1269,7 +1269,7 @@ def make_stock_in_entry(source_name, target_doc=None):
"Stock Entry": {
"doctype": "Stock Entry",
"field_map": {
"name": "outward_stock_entry"
"name": "outgoing_stock_entry"
},
"validation": {
"docstatus": ["=", 1]

View File

@ -5,11 +5,11 @@ frappe.listview_settings['Stock Entry'] = {
if (doc.docstatus === 0) {
return [__("Draft"), "red", "docstatus,=,0"];
} else if (doc.purpose === 'Stock Out' && doc.per_transferred < 100) {
} else if (doc.purpose === 'Send to Warehouse' && doc.per_transferred < 100) {
// not delivered & overdue
return [__("Goods In Transit"), "grey", "per_transferred,<,100"];
} else if (doc.purpose === 'Stock Out' && doc.per_transferred === 100) {
} else if (doc.purpose === 'Send to Warehouse' && doc.per_transferred === 100) {
return [__("Goods Transferred"), "green", "per_transferred,=,100"];
} else if (doc.docstatus === 2) {
return [__("Canceled"), "red", "docstatus,=,2"];

View File

@ -752,7 +752,7 @@ class TestStockEntry(unittest.TestCase):
create_warehouse("_Test Warehouse FG 1")
outward_entry = make_stock_entry(item_code="_Test Item",
purpose="Stock Out",
purpose="Send to Warehouse",
source="_Test Warehouse - _TC",
target="_Test Warehouse 1 - _TC", qty=50, basic_rate=100)

View File

@ -35,7 +35,7 @@
"label": "Purpose",
"length": 0,
"no_copy": 0,
"options": "\nMaterial Issue\nMaterial Receipt\nMaterial Transfer\nMaterial Transfer for Manufacture\nMaterial Consumption for Manufacture\nManufacture\nRepack\nSubcontract\nStock Out\nStock In",
"options": "\nMaterial Issue\nMaterial Receipt\nMaterial Transfer\nMaterial Transfer for Manufacture\nMaterial Consumption for Manufacture\nManufacture\nRepack\nSubcontract\nSend to Warehouse\nReceive at Warehouse",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -60,7 +60,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2019-03-13 19:30:42.144377",
"modified": "2019-03-25 19:30:42.144377",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Type",