PPT looks at default MR type in Item to set MR type.

This commit is contained in:
Rohit Waghchaure 2016-07-29 13:23:30 +05:30
parent afc0bbc8ff
commit 08aadb853c
6 changed files with 45 additions and 9 deletions

View File

@ -451,10 +451,8 @@ class ProductionPlanningTool(Document):
"company": self.company,
"requested_by": frappe.session.user
})
if item_wrapper.default_bom:
material_request.update({"material_request_type": "Manufacture"})
else:
material_request.update({"material_request_type": "Purchase"})
material_request.update({"material_request_type": item_wrapper.default_material_request_type})
for sales_order, requested_qty in items_to_be_requested[item].items():
material_request.append("items", {
"doctype": "Material Request Item",

View File

@ -306,4 +306,5 @@ erpnext.patches.v7_0.calculate_total_costing_amount
erpnext.patches.v7_0.fix_nonwarehouse_ledger_gl_entries_for_transactions
erpnext.patches.v7_0.remove_old_earning_deduction_doctypes
erpnext.patches.v7_0.make_guardian
erpnext.patches.v7_0.update_refdoc_in_landed_cost_voucher
erpnext.patches.v7_0.update_refdoc_in_landed_cost_voucher
execute:frappe.db.sql("update `tabItem` set default_material_request_type= case when default_bom is not null then 'Manufacture' else 'Purchase' end")

View File

@ -116,6 +116,14 @@ frappe.ui.form.on("Item", {
}
});
frappe.ui.form.on('Item Reorder', {
reorder_levels_add: function(frm, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
type = frm.doc.default_material_request_type
row.material_request_type = (type == 'Material Transfer')? 'Transfer' : type;
}
})
$.extend(erpnext.item, {
setup_queries: function(frm) {
frm.fields_dict['expense_account'].get_query = function(doc) {
@ -351,6 +359,7 @@ $.extend(erpnext.item, {
}
});
cur_frm.add_fetch('attribute', 'numeric_values', 'numeric_values');
cur_frm.add_fetch('attribute', 'from_range', 'from_range');
cur_frm.add_fetch('attribute', 'to_range', 'to_range');

View File

@ -705,6 +705,33 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Purchase",
"fieldname": "default_material_request_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Default Material Request Type",
"length": 0,
"no_copy": 0,
"options": "Purchase\nMaterial Transfer\nMaterial Issue\nManufacture",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -2308,7 +2335,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
"modified": "2016-07-21 18:44:10.230372",
"modified": "2016-07-28 19:12:27.253074",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",

View File

@ -124,8 +124,9 @@
"label": "Material Request Type",
"length": 0,
"no_copy": 0,
"options": "Purchase\nTransfer",
"options": "Purchase\nTransfer\nMaterial Issue\nManufacture",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
@ -146,7 +147,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-07-11 03:59:06.870780",
"modified": "2016-07-28 19:15:38.270046",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Reorder",

View File

@ -16,7 +16,7 @@ def reorder_item():
return _reorder_item()
def _reorder_item():
material_requests = {"Purchase": {}, "Transfer": {}}
material_requests = {"Purchase": {}, "Transfer": {}, "Material Issue": {}, "Manufacture": {}}
warehouse_company = frappe._dict(frappe.db.sql("""select name, company from `tabWarehouse`
where disabled=0"""))
default_company = (erpnext.get_default_company() or