diff --git a/buying/DocType Mapper/Material Request-Purchase Order/Material Request-Purchase Order.txt b/buying/DocType Mapper/Material Request-Purchase Order/Material Request-Purchase Order.txt new file mode 100644 index 00000000000..5d01ac03144 --- /dev/null +++ b/buying/DocType Mapper/Material Request-Purchase Order/Material Request-Purchase Order.txt @@ -0,0 +1,125 @@ +[ + { + "creation": "2010-08-08 17:09:34", + "docstatus": 0, + "modified": "2013-02-18 13:41:16", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "doctype": "Table Mapper Detail", + "name": "__common__", + "parent": "Material Request-Purchase Order", + "parentfield": "table_mapper_details", + "parenttype": "DocType Mapper" + }, + { + "doctype": "Field Mapper Detail", + "name": "__common__", + "parent": "Material Request-Purchase Order", + "parentfield": "field_mapper_details", + "parenttype": "DocType Mapper" + }, + { + "doctype": "DocType Mapper", + "from_doctype": "Material Request", + "module": "Buying", + "name": "__common__", + "ref_doc_submitted": 1, + "to_doctype": "Purchase Order" + }, + { + "doctype": "DocType Mapper", + "name": "Material Request-Purchase Order" + }, + { + "checking_operator": "=", + "doctype": "Field Mapper Detail", + "from_field": "company", + "map": "Yes", + "match_id": 0, + "to_field": "company" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "parenttype", + "map": "Yes", + "match_id": 1, + "to_field": "prevdoc_doctype" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "parent", + "map": "Yes", + "match_id": 1, + "to_field": "prevdoc_docname" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "name", + "map": "Yes", + "match_id": 1, + "to_field": "prevdoc_detail_docname" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "uom", + "map": "Yes", + "match_id": 1, + "to_field": "stock_uom" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "eval:flt(1)", + "map": "Yes", + "match_id": 1, + "to_field": "conversion_factor" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "eval:flt(obj.qty) - flt(obj.ordered_qty)", + "map": "Yes", + "match_id": 1, + "to_field": "stock_qty" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "eval:flt(obj.qty) - flt(obj.ordered_qty)", + "map": "Yes", + "match_id": 1, + "to_field": "qty" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "schedule_date", + "map": "Yes", + "match_id": 1, + "to_field": "schedule_date" + }, + { + "checking_operator": ">=", + "doctype": "Field Mapper Detail", + "from_field": "transaction_date", + "map": "No", + "match_id": 0, + "to_field": "transaction_date" + }, + { + "doctype": "Table Mapper Detail", + "from_table": "Material Request", + "match_id": 0, + "reference_key": "prevdoc_docname", + "to_table": "Purchase Order", + "validation_logic": "docstatus = 1" + }, + { + "doctype": "Table Mapper Detail", + "from_field": "indent_details", + "from_table": "Material Request Item", + "match_id": 1, + "reference_doctype_key": "prevdoc_doctype", + "to_field": "po_details", + "to_table": "Purchase Order Item", + "validation_logic": "qty > ifnull(ordered_qty,0) and docstatus =1" + } +] \ No newline at end of file diff --git a/buying/DocType Mapper/Material Request-Supplier Quotation/Material Request-Supplier Quotation.txt b/buying/DocType Mapper/Material Request-Supplier Quotation/Material Request-Supplier Quotation.txt new file mode 100644 index 00000000000..0e9bc50735d --- /dev/null +++ b/buying/DocType Mapper/Material Request-Supplier Quotation/Material Request-Supplier Quotation.txt @@ -0,0 +1,90 @@ +[ + { + "creation": "2012-08-06 20:02:53", + "docstatus": 0, + "modified": "2013-02-18 13:41:13", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "doctype": "Table Mapper Detail", + "name": "__common__", + "parent": "Material Request-Supplier Quotation", + "parentfield": "table_mapper_details", + "parenttype": "DocType Mapper" + }, + { + "doctype": "Field Mapper Detail", + "name": "__common__", + "parent": "Material Request-Supplier Quotation", + "parentfield": "field_mapper_details", + "parenttype": "DocType Mapper" + }, + { + "doctype": "DocType Mapper", + "from_doctype": "Material Request", + "module": "Buying", + "name": "__common__", + "ref_doc_submitted": 1, + "to_doctype": "Supplier Quotation" + }, + { + "doctype": "DocType Mapper", + "name": "Material Request-Supplier Quotation" + }, + { + "checking_operator": "=", + "doctype": "Field Mapper Detail", + "from_field": "company", + "map": "Yes", + "match_id": 0, + "to_field": "company" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "parenttype", + "map": "Yes", + "match_id": 1, + "to_field": "prevdoc_doctype" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "parent", + "map": "Yes", + "match_id": 1, + "to_field": "prevdoc_docname" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "name", + "map": "Yes", + "match_id": 1, + "to_field": "prevdoc_detail_docname" + }, + { + "checking_operator": ">=", + "doctype": "Field Mapper Detail", + "from_field": "transaction_date", + "map": "No", + "match_id": 0, + "to_field": "transaction_date" + }, + { + "doctype": "Table Mapper Detail", + "from_table": "Material Request", + "match_id": 0, + "reference_key": "prevdoc_docname", + "to_table": "Supplier Quotation", + "validation_logic": "docstatus = 1" + }, + { + "doctype": "Table Mapper Detail", + "from_field": "indent_details", + "from_table": "Material Request Item", + "match_id": 1, + "reference_doctype_key": "prevdoc_doctype", + "to_field": "quotation_items", + "to_table": "Supplier Quotation Item", + "validation_logic": "docstatus =1" + } +] \ No newline at end of file diff --git a/buying/DocType Mapper/Sales Order-Material Request/Sales Order-Material Request.txt b/buying/DocType Mapper/Sales Order-Material Request/Sales Order-Material Request.txt new file mode 100644 index 00000000000..a3c5d634a45 --- /dev/null +++ b/buying/DocType Mapper/Sales Order-Material Request/Sales Order-Material Request.txt @@ -0,0 +1,91 @@ +[ + { + "creation": "2011-05-20 10:07:55", + "docstatus": 0, + "modified": "2013-02-18 13:41:21", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "doctype": "Table Mapper Detail", + "name": "__common__", + "parent": "Sales Order-Material Request", + "parentfield": "table_mapper_details", + "parenttype": "DocType Mapper" + }, + { + "doctype": "Field Mapper Detail", + "name": "__common__", + "parent": "Sales Order-Material Request", + "parentfield": "field_mapper_details", + "parenttype": "DocType Mapper" + }, + { + "doctype": "DocType Mapper", + "from_doctype": "Sales Order", + "module": "Buying", + "name": "__common__", + "ref_doc_submitted": 1, + "to_doctype": "Material Request" + }, + { + "doctype": "DocType Mapper", + "name": "Sales Order-Material Request" + }, + { + "checking_operator": ">=", + "doctype": "Field Mapper Detail", + "from_field": "transaction_date", + "map": "No", + "match_id": 0, + "to_field": "transaction_date" + }, + { + "checking_operator": "=", + "doctype": "Field Mapper Detail", + "from_field": "company", + "map": "Yes", + "match_id": 0, + "to_field": "company" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "parent", + "map": "Yes", + "match_id": 1, + "to_field": "sales_order_no" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "stock_uom", + "map": "Yes", + "match_id": 1, + "to_field": "uom" + }, + { + "doctype": "Field Mapper Detail", + "from_field": "reserved_warehouse", + "map": "Yes", + "match_id": 1, + "to_field": "warehouse" + }, + { + "doctype": "Table Mapper Detail", + "from_field": "sales_order_details", + "from_table": "Sales Order Item", + "match_id": 1, + "reference_doctype_key": "prevdoc_doctype", + "reference_key": "prevdoc_detail_docname", + "to_field": "indent_details", + "to_table": "Material Request Item", + "validation_logic": "docstatus=1" + }, + { + "doctype": "Table Mapper Detail", + "from_table": "Sales Order", + "match_id": 0, + "reference_key": "prevdoc_docname", + "to_table": "Material Request", + "validation_logic": "docstatus = 1" + } +] \ No newline at end of file diff --git a/buying/doctype/purchase_common/purchase_common.py b/buying/doctype/purchase_common/purchase_common.py index 550fc9f3698..a0133d6e761 100644 --- a/buying/doctype/purchase_common/purchase_common.py +++ b/buying/doctype/purchase_common/purchase_common.py @@ -33,17 +33,17 @@ class DocType(BuyingController): self.doc = doc self.doclist = doclist - self.chk_tol_for_list = ['Purchase Request - Purchase Order', 'Purchase Order - Purchase Receipt', 'Purchase Order - Purchase Invoice'] + self.chk_tol_for_list = ['Material Request - Purchase Order', 'Purchase Order - Purchase Receipt', 'Purchase Order - Purchase Invoice'] self.update_qty = { - 'Purchase Request - Purchase Order': 'ordered_qty', + 'Material Request - Purchase Order': 'ordered_qty', 'Purchase Order - Purchase Receipt': 'received_qty', 'Purchase Order - Purchase Invoice': 'billed_qty', 'Purchase Receipt - Purchase Invoice': 'billed_qty' } self.update_percent_field = { - 'Purchase Request - Purchase Order': 'per_ordered', + 'Material Request - Purchase Order': 'per_ordered', 'Purchase Order - Purchase Receipt': 'per_received', 'Purchase Order - Purchase Invoice': 'per_billed', 'Purchase Receipt - Purchase Invoice': 'per_billed' @@ -51,7 +51,7 @@ class DocType(BuyingController): # used in validation for items and update_prevdoc_detail self.doctype_dict = { - 'Purchase Request': 'Purchase Request Item', + 'Material Request': 'Material Request Item', 'Purchase Order': 'Purchase Order Item', 'Purchase Receipt': 'Purchase Receipt Item' } @@ -75,7 +75,7 @@ class DocType(BuyingController): item = sql("select lead_time_days from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())" % cstr(d.item_code) , as_dict = 1) ltd = item and cint(item[0]['lead_time_days']) or 0 if ltd and obj.doc.transaction_date: - if d.fields.has_key('lead_time_date') or obj.doc.doctype == 'Purchase Request': + if d.fields.has_key('lead_time_date') or obj.doc.doctype == 'Material Request': d.lead_time_date = cstr(add_days( obj.doc.transaction_date, cint(ltd))) if not d.fields.has_key('prevdoc_docname') or (d.fields.has_key('prevdoc_docname') and not d.prevdoc_docname): d.schedule_date = cstr( add_days( obj.doc.transaction_date, cint(ltd))) @@ -219,7 +219,7 @@ class DocType(BuyingController): raise Exception # Check if UOM has been modified. - if not cstr(data[0]['uom']) == cstr(d.uom) and not cstr(d.prevdoc_doctype) == 'Purchase Request': + if not cstr(data[0]['uom']) == cstr(d.uom) and not cstr(d.prevdoc_doctype) == 'Material Request': msgprint("Please check UOM %s of Item %s which is not present in %s %s ." % (d.uom, d.item_code, d.prevdoc_doctype, d.prevdoc_docname)) raise Exception @@ -288,11 +288,11 @@ class DocType(BuyingController): def get_qty(self,curr_doctype,ref_tab_fname,ref_tab_dn,ref_doc_tname, transaction, curr_parent_name): # Get total Quantities of current doctype (eg. PR) except for qty of this transaction #------------------------------ - # please check as UOM changes from Purchase Request - Purchase Order ,so doing following else uom should be same . + # please check as UOM changes from Material Request - Purchase Order ,so doing following else uom should be same . # i.e. in PO uom is NOS then in PR uom should be NOS - # but if in Purchase Request uom KG it can change in PO + # but if in Material Request uom KG it can change in PO - get_qty = (transaction == 'Purchase Request - Purchase Order') and 'qty * conversion_factor' or 'qty' + get_qty = (transaction == 'Material Request - Purchase Order') and 'qty * conversion_factor' or 'qty' qty = sql("select sum(%s) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% ( get_qty, curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name)) qty = qty and flt(qty[0][0]) or 0 @@ -312,8 +312,8 @@ class DocType(BuyingController): qty, max_qty, max_qty_plus_tol = flt(curr_ref_qty.split('~~~')[0]), flt(curr_ref_qty.split('~~~')[1]), flt(curr_ref_qty.split('~~~')[1]) # Qty above Tolerance should be allowed only once. - # But there is special case for Transaction 'Purchase Request-Purhcase Order' that there should be no restriction - # One can create any no. of PO against same Purchase Request!!! + # But there is special case for Transaction 'Material Request-Purhcase Order' that there should be no restriction + # One can create any no. of PO against same Material Request!!! if qty >= max_qty and is_submit and flt(curr_qty) > 0: reason = (curr_parent_doctype == 'Purchase Order') and 'Ordered' or (curr_parent_doctype == 'Purchase Receipt') and 'Received' or (curr_parent_doctype == 'Purchase Invoice') and 'Billed' msgprint("Error: Item Code : '%s' of '%s' is already %s." %(item_code,ref_dn,reason)) @@ -364,7 +364,7 @@ class DocType(BuyingController): if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname: transaction = cstr(d.prevdoc_doctype) + ' - ' + cstr(obj.doc.doctype) - curr_qty = (transaction == 'Purchase Request - Purchase Order') and flt(d.qty) * flt(d.conversion_factor) or flt(d.qty) + curr_qty = (transaction == 'Material Request - Purchase Order') and flt(d.qty) * flt(d.conversion_factor) or flt(d.qty) self.update_ref_doctype_dict( flt(curr_qty), d.doctype, d.prevdoc_docname, d.prevdoc_doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, transaction, d.item_code, is_submit, obj.doc.doctype, obj.doc.name) # for payable voucher diff --git a/buying/doctype/purchase_order/purchase_order.js b/buying/doctype/purchase_order/purchase_order.js index fa377049166..7b6ffc15ba5 100644 --- a/buying/doctype/purchase_order/purchase_order.js +++ b/buying/doctype/purchase_order/purchase_order.js @@ -109,7 +109,7 @@ cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = fun } cur_frm.fields_dict['indent_no'].get_query = function(doc) { - return 'SELECT DISTINCT `tabPurchase Request`.`name` FROM `tabPurchase Request` WHERE `tabPurchase Request`.company = "' + doc.company + '" and `tabPurchase Request`.`docstatus` = 1 and `tabPurchase Request`.`status` != "Stopped" and ifnull(`tabPurchase Request`.`per_ordered`,0) < 99.99 and `tabPurchase Request`.%(key)s LIKE "%s" ORDER BY `tabPurchase Request`.`name` DESC LIMIT 50'; + return 'SELECT DISTINCT `tabMaterial Request`.`name` FROM `tabMaterial Request` WHERE `tabMaterial Request`.company = "' + doc.company + '" and `tabMaterial Request`.`docstatus` = 1 and `tabMaterial Request`.`status` != "Stopped" and ifnull(`tabMaterial Request`.`per_ordered`,0) < 99.99 and `tabMaterial Request`.%(key)s LIKE "%s" ORDER BY `tabMaterial Request`.`name` DESC LIMIT 50'; } @@ -208,7 +208,7 @@ cur_frm.pformat.indent_no = function(doc, cdt, cdn){ if(cl.length){ prevdoc_list = new Array(); for(var i=0;i flt(d.received_qty) and \ flt( flt(flt(d.qty) - flt(d.received_qty))*flt(d.conversion_factor)) or 0 - # No updates in Purchase Request on Stop / Unstop - if cstr(d.prevdoc_doctype) == 'Purchase Request' and not is_stopped: + # No updates in Material Request on Stop / Unstop + if cstr(d.prevdoc_doctype) == 'Material Request' and not is_stopped: # get qty and pending_qty of prevdoc curr_ref_qty = pc_obj.get_qty(d.doctype, 'prevdoc_detail_docname', - d.prevdoc_detail_docname, 'Purchase Request Item', - 'Purchase Request - Purchase Order', self.doc.name) + d.prevdoc_detail_docname, 'Material Request Item', + 'Material Request - Purchase Order', self.doc.name) max_qty, qty, curr_qty = flt(curr_ref_qty.split('~~~')[1]), \ flt(curr_ref_qty.split('~~~')[0]), 0 if flt(qty) + flt(po_qty) > flt(max_qty): curr_qty = flt(max_qty) - flt(qty) # special case as there is no restriction - # for Purchase Request - Purchase Order + # for Material Request - Purchase Order curr_qty = curr_qty > 0 and curr_qty or 0 else: curr_qty = flt(po_qty) @@ -232,7 +232,7 @@ class DocType(BuyingController): # 4.Set Status as Cancelled webnotes.conn.set(self.doc,'status','Cancelled') - # 5.Update Purchase Requests Pending Qty and accordingly it's Status + # 5.Update Material Requests Pending Qty and accordingly it's Status pc_obj.update_prevdoc_detail(self,is_submit = 0) # 6.Update Bin diff --git a/buying/doctype/purchase_order/purchase_order.txt b/buying/doctype/purchase_order/purchase_order.txt index 38c526e5421..101b0a93e57 100644 --- a/buying/doctype/purchase_order/purchase_order.txt +++ b/buying/doctype/purchase_order/purchase_order.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-29 17:54:10", + "creation": "2013-01-29 19:25:50", "docstatus": 0, - "modified": "2013-01-29 18:16:48", + "modified": "2013-02-18 13:37:11", "modified_by": "Administrator", "owner": "Administrator" }, @@ -31,9 +31,7 @@ "parent": "Purchase Order", "parentfield": "permissions", "parenttype": "DocType", - "permlevel": 0, - "read": 1, - "report": 1 + "read": 1 }, { "doctype": "DocType", @@ -181,16 +179,16 @@ "fieldtype": "Section Break" }, { - "description": "You can make a purchase order from multiple Purchase Requests. Select Purchase Requests one by one and click on the button below.", + "description": "You can make a purchase order from multiple Material Requests. Select Material Requests one by one and click on the button below.", "doctype": "DocField", "fieldname": "indent_no", "fieldtype": "Link", "hidden": 0, - "label": "Select Purchase Request", + "label": "Select Material Request", "no_copy": 1, "oldfieldname": "indent_no", "oldfieldtype": "Link", - "options": "Purchase Request", + "options": "Material Request", "print_hide": 1 }, { @@ -814,26 +812,58 @@ "no_copy": 1, "print_hide": 1 }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "report": 0, + "role": "Material User", + "submit": 0, + "write": 0 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 0, + "report": 1, + "role": "Material User", + "submit": 0, + "write": 0 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "report": 0, + "role": "Purchase Manager", + "submit": 0, + "write": 0 + }, { "amend": 1, "cancel": 1, "create": 1, "doctype": "DocPerm", - "role": "Purchase User", + "permlevel": 0, + "report": 1, + "role": "Purchase Manager", "submit": 1, "write": 1 }, - { - "doctype": "DocPerm", - "match": "supplier", - "role": "Supplier" - }, { "amend": 1, "cancel": 1, "create": 1, "doctype": "DocPerm", - "role": "Purchase Manager", + "permlevel": 0, + "report": 1, + "role": "Purchase User", "submit": 1, "write": 1 }, @@ -842,8 +872,15 @@ "cancel": 0, "create": 0, "doctype": "DocPerm", - "role": "Material User", - "submit": 0, - "write": 0 + "permlevel": 1, + "role": "All", + "submit": 0 + }, + { + "doctype": "DocPerm", + "match": "supplier", + "permlevel": 0, + "report": 1, + "role": "Supplier" } ] \ No newline at end of file diff --git a/buying/doctype/purchase_order_item/purchase_order_item.txt b/buying/doctype/purchase_order_item/purchase_order_item.txt index c8c21cac779..edb30928f95 100755 --- a/buying/doctype/purchase_order_item/purchase_order_item.txt +++ b/buying/doctype/purchase_order_item/purchase_order_item.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-30 12:49:48", + "creation": "2013-02-07 11:00:11", "docstatus": 0, - "modified": "2013-02-07 10:49:35", + "modified": "2013-02-18 13:39:02", "modified_by": "Administrator", "owner": "Administrator" }, @@ -249,11 +249,11 @@ "fieldtype": "Link", "hidden": 0, "in_filter": 1, - "label": "Purchase Requisition No", + "label": "Material Request No", "no_copy": 0, "oldfieldname": "prevdoc_docname", "oldfieldtype": "Link", - "options": "Purchase Request", + "options": "Material Request", "print_hide": 1, "print_width": "120px", "read_only": 1, @@ -266,7 +266,7 @@ "fieldtype": "Date", "hidden": 1, "in_filter": 1, - "label": "Purchase Request Date", + "label": "Material Request Date", "oldfieldname": "prevdoc_date", "oldfieldtype": "Date", "print_hide": 1, @@ -279,7 +279,7 @@ "fieldtype": "Data", "hidden": 1, "in_filter": 1, - "label": "Purchase Request Detail No", + "label": "Material Request Detail No", "no_copy": 0, "oldfieldname": "prevdoc_detail_docname", "oldfieldtype": "Data", diff --git a/buying/doctype/supplier_quotation/supplier_quotation.js b/buying/doctype/supplier_quotation/supplier_quotation.js index 87bf63cd6f8..706056ccf22 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/buying/doctype/supplier_quotation/supplier_quotation.js @@ -88,13 +88,13 @@ cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query } cur_frm.fields_dict['indent_no'].get_query = function(doc) { - return "select distinct `tabPurchase Request`.`name` from `tabPurchase Request` \ - where `tabPurchase Request`.company = \"" + doc.company + - "\" and `tabPurchase Request`.`docstatus` = 1 and \ - `tabPurchase Request`.`status` != \"Stopped\" and \ - ifnull(`tabPurchase Request`.`per_ordered`,0) < 99.99 and \ - `tabPurchase Request`.%(key)s LIKE \"%s\" \ - order by `tabPurchase Request`.`name` desc limit 50"; + return "select distinct `tabMaterial Request`.`name` from `tabMaterial Request` \ + where `tabMaterial Request`.company = \"" + doc.company + + "\" and `tabMaterial Request`.`docstatus` = 1 and \ + `tabMaterial Request`.`status` != \"Stopped\" and \ + ifnull(`tabMaterial Request`.`per_ordered`,0) < 99.99 and \ + `tabMaterial Request`.%(key)s LIKE \"%s\" \ + order by `tabMaterial Request`.`name` desc limit 50"; } cur_frm.cscript.supplier_address = function(doc, dt, dn) { diff --git a/buying/doctype/supplier_quotation/supplier_quotation.py b/buying/doctype/supplier_quotation/supplier_quotation.py index 51a1e07a7fa..28b8e1420f9 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.py +++ b/buying/doctype/supplier_quotation/supplier_quotation.py @@ -52,10 +52,10 @@ class DocType(BuyingController): def get_indent_details(self): if self.doc.indent_no: - mapper = get_obj("DocType Mapper", "Purchase Request-Supplier Quotation") - mapper.dt_map("Purchase Request", "Supplier Quotation", self.doc.indent_no, - self.doc, self.doclist, """[['Purchase Request', 'Supplier Quotation'], - ['Purchase Request Item', 'Supplier Quotation Item']]""") + mapper = get_obj("DocType Mapper", "Material Request-Supplier Quotation") + mapper.dt_map("Material Request", "Supplier Quotation", self.doc.indent_no, + self.doc, self.doclist, """[['Material Request', 'Supplier Quotation'], + ['Material Request Item', 'Supplier Quotation Item']]""") from webnotes.model.wrapper import getlist for d in getlist(self.doclist, self.fname): diff --git a/buying/doctype/supplier_quotation/supplier_quotation.txt b/buying/doctype/supplier_quotation/supplier_quotation.txt index f5fa37d78ac..d180651b196 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.txt +++ b/buying/doctype/supplier_quotation/supplier_quotation.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-29 17:54:11", + "creation": "2013-01-29 19:25:54", "docstatus": 0, - "modified": "2013-01-29 18:11:12", + "modified": "2013-02-18 13:40:17", "modified_by": "Administrator", "owner": "Administrator" }, @@ -31,9 +31,7 @@ "parent": "Supplier Quotation", "parentfield": "permissions", "parenttype": "DocType", - "permlevel": 0, - "read": 1, - "report": 1 + "read": 1 }, { "doctype": "DocType", @@ -167,16 +165,16 @@ "options": "Simple" }, { - "description": "You can make a purchase order from multiple Purchase Requests. Select Purchase Requests one by one and click on the button below.", + "description": "You can make a purchase order from multiple Material Requests. Select Material Requests one by one and click on the button below.", "doctype": "DocField", "fieldname": "indent_no", "fieldtype": "Link", "hidden": 0, - "label": "Select Purchase Request", + "label": "Select Material Request", "no_copy": 1, "oldfieldname": "indent_no", "oldfieldtype": "Link", - "options": "Purchase Request", + "options": "Material Request", "print_hide": 1 }, { @@ -679,6 +677,8 @@ "cancel": 1, "create": 1, "doctype": "DocPerm", + "permlevel": 0, + "report": 1, "role": "Manufacturing Manager", "submit": 1, "write": 1 @@ -688,6 +688,8 @@ "cancel": 1, "create": 1, "doctype": "DocPerm", + "permlevel": 0, + "report": 1, "role": "Purchase Manager", "submit": 1, "write": 1 @@ -697,6 +699,8 @@ "cancel": 0, "create": 1, "doctype": "DocPerm", + "permlevel": 0, + "report": 1, "role": "Purchase User", "submit": 0, "write": 1 @@ -706,6 +710,8 @@ "cancel": 0, "create": 0, "doctype": "DocPerm", + "permlevel": 0, + "report": 1, "role": "Material User", "submit": 0, "write": 0 @@ -715,8 +721,21 @@ "cancel": 0, "create": 0, "doctype": "DocPerm", + "permlevel": 0, + "report": 1, "role": "Supplier", "submit": 0, "write": 0 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "report": 0, + "role": "All", + "submit": 0, + "write": 0 } ] \ No newline at end of file diff --git a/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt b/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt index ab1f3e47797..cf79f041d52 100644 --- a/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt +++ b/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-28 10:06:00", + "creation": "2013-01-29 19:25:55", "docstatus": 0, - "modified": "2013-01-29 16:28:05", + "modified": "2013-02-18 13:39:45", "modified_by": "Administrator", "owner": "Administrator" }, @@ -208,11 +208,11 @@ "fieldtype": "Link", "hidden": 0, "in_filter": 1, - "label": "Purchase Request No", + "label": "Material Request No", "no_copy": 0, "oldfieldname": "prevdoc_docname", "oldfieldtype": "Link", - "options": "Purchase Request", + "options": "Material Request", "print_hide": 1, "print_width": "120px", "read_only": 1, @@ -225,7 +225,7 @@ "fieldtype": "Date", "hidden": 1, "in_filter": 1, - "label": "Purchase Request Date", + "label": "Material Request Date", "oldfieldname": "prevdoc_date", "oldfieldtype": "Date", "print_hide": 1, @@ -238,7 +238,7 @@ "fieldtype": "Data", "hidden": 1, "in_filter": 1, - "label": "Purchase Request Detail No", + "label": "Material Request Detail No", "no_copy": 0, "oldfieldname": "prevdoc_detail_docname", "oldfieldtype": "Data", diff --git a/buying/page/buying_home/buying_home.js b/buying/page/buying_home/buying_home.js index 0924ba3e469..922e7acefab 100644 --- a/buying/page/buying_home/buying_home.js +++ b/buying/page/buying_home/buying_home.js @@ -7,9 +7,9 @@ wn.module_page["Buying"] = [ icon: "icon-copy", items: [ { - label: wn._("Purchase Request"), + label: wn._("Material Request"), description: wn._("Request for purchase."), - doctype:"Purchase Request" + doctype:"Material Request" }, { label: wn._("Supplier Quotation"), diff --git a/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt b/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt index 8650d20cba5..9cb44a5b00b 100644 --- a/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt +++ b/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt @@ -21,7 +21,7 @@ "sort_by": "`tabPurchase Order`.`name`", "page_len": 50, "criteria_name": "Pending PO Items To Bill", - "columns": "Purchase Order\u0001ID,Purchase Order\u0001Supplier,Purchase Order\u0001Supplier Name,Purchase Order\u0001Status,Purchase Order\u0001PO Date,Purchase Order\u0001Fiscal Year,Purchase Order Item\u0001Purchase Request No,Purchase Order Item\u0001Item Code,Purchase Order Item\u0001Item Name,Purchase Order Item\u0001Description,Purchase Order Item\u0001Quantity,Purchase Order Item\u0001UOM,Purchase Order Item\u0001Received Qty" + "columns": "Purchase Order\u0001ID,Purchase Order\u0001Supplier,Purchase Order\u0001Supplier Name,Purchase Order\u0001Status,Purchase Order\u0001PO Date,Purchase Order\u0001Fiscal Year,Purchase Order Item\u0001Material Request No,Purchase Order Item\u0001Item Code,Purchase Order Item\u0001Item Name,Purchase Order Item\u0001Description,Purchase Order Item\u0001Quantity,Purchase Order Item\u0001UOM,Purchase Order Item\u0001Received Qty" }, { "name": "pending_po_items_to_bill", diff --git a/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt b/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt index a103fb501dc..51cf16590dc 100644 --- a/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt +++ b/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt @@ -21,7 +21,7 @@ "sort_by": "`tabPurchase Order`.`name`", "page_len": 50, "criteria_name": "Pending PO Items To Receive", - "columns": "Purchase Order\u0001ID,Purchase Order\u0001Supplier,Purchase Order\u0001Supplier Name,Purchase Order\u0001Status,Purchase Order\u0001PO Date,Purchase Order\u0001Fiscal Year,Purchase Order Item\u0001Purchase Request No,Purchase Order Item\u0001Item Code,Purchase Order Item\u0001Item Name,Purchase Order Item\u0001Description,Purchase Order Item\u0001Quantity,Purchase Order Item\u0001UOM,Purchase Order Item\u0001Received Qty" + "columns": "Purchase Order\u0001ID,Purchase Order\u0001Supplier,Purchase Order\u0001Supplier Name,Purchase Order\u0001Status,Purchase Order\u0001PO Date,Purchase Order\u0001Fiscal Year,Purchase Order Item\u0001Material Request No,Purchase Order Item\u0001Item Code,Purchase Order Item\u0001Item Name,Purchase Order Item\u0001Description,Purchase Order Item\u0001Quantity,Purchase Order Item\u0001UOM,Purchase Order Item\u0001Received Qty" }, { "name": "pending_po_items_to_receive", diff --git a/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/manufacturing/doctype/production_planning_tool/production_planning_tool.py index a6c8458f3f0..b83441b0b8b 100644 --- a/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -301,11 +301,11 @@ class DocType: def raise_purchase_request(self): """ - Raise Purchase Request if projected qty is less than qty required + Raise Material Request if projected qty is less than qty required Requested qty should be shortage qty considering minimum order qty """ if not self.doc.purchase_request_for_warehouse: - webnotes.msgprint("Please enter Warehouse for which Purchase Request will be raised", + webnotes.msgprint("Please enter Warehouse for which Material Request will be raised", raise_exception=1) bom_dict = self.get_distinct_items_and_boms()[0] @@ -342,7 +342,7 @@ class DocType: item_wrapper = webnotes.model_wrapper("Item", item) pr_doclist = [ { - "doctype": "Purchase Request", + "doctype": "Material Request", "__islocal": 1, "naming_series": "IDT", "transaction_date": nowdate(), @@ -353,7 +353,7 @@ class DocType: "remark": "Automatically raised from Production Planning Tool" }, { - "doctype": "Purchase Request Item", + "doctype": "Material Request Item", "__islocal": 1, "parentfield": "indent_details", "item_code": item, @@ -373,9 +373,9 @@ class DocType: purchase_request_list.append(pr_wrapper.doc.name) if purchase_request_list: - pur_req = ["""%s""" % \ + pur_req = ["""%s""" % \ (p, p) for p in purchase_request_list] - webnotes.msgprint("Following Purchase Request created successfully: \n%s" % + webnotes.msgprint("Following Material Request created successfully: \n%s" % "\n".join(pur_req)) else: webnotes.msgprint("Nothing to request") \ No newline at end of file diff --git a/manufacturing/doctype/production_planning_tool/production_planning_tool.txt b/manufacturing/doctype/production_planning_tool/production_planning_tool.txt index dc1eb513996..4b37f9849d5 100644 --- a/manufacturing/doctype/production_planning_tool/production_planning_tool.txt +++ b/manufacturing/doctype/production_planning_tool/production_planning_tool.txt @@ -1,97 +1,97 @@ [ { - "owner": "jai@webnotestech.com", + "creation": "2013-01-21 12:03:47", "docstatus": 0, - "creation": "2013-01-19 10:23:35", + "modified": "2013-02-18 13:43:26", "modified_by": "Administrator", - "modified": "2013-01-19 10:55:55" + "owner": "jai@webnotestech.com" }, { - "read_only": 1, - "issingle": 1, - "in_create": 1, "default_print_format": "Standard", "doctype": "DocType", + "in_create": 1, + "issingle": 1, "module": "Manufacturing", - "name": "__common__" + "name": "__common__", + "read_only": 1 }, { - "name": "__common__", - "parent": "Production Planning Tool", "doctype": "DocField", - "parenttype": "DocType", - "permlevel": 0, - "parentfield": "fields" - }, - { "name": "__common__", "parent": "Production Planning Tool", - "read": 1, - "create": 1, - "submit": 0, - "doctype": "DocPerm", - "write": 1, + "parentfield": "fields", "parenttype": "DocType", - "report": 0, - "permlevel": 0, - "parentfield": "permissions" + "permlevel": 0 }, { - "name": "Production Planning Tool", - "doctype": "DocType" + "create": 1, + "doctype": "DocPerm", + "name": "__common__", + "parent": "Production Planning Tool", + "parentfield": "permissions", + "parenttype": "DocType", + "permlevel": 0, + "read": 1, + "report": 0, + "submit": 0, + "write": 1 + }, + { + "doctype": "DocType", + "name": "Production Planning Tool" }, { "description": "Select Sales Orders from which you want to create Production Orders.", "doctype": "DocField", - "label": "Select Sales Orders", "fieldname": "select_sales_orders", - "fieldtype": "Section Break" + "fieldtype": "Section Break", + "label": "Select Sales Orders" }, { "doctype": "DocField", - "width": "50%", "fieldname": "column_break0", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "width": "50%" }, { "doctype": "DocField", - "label": "Filter based on item", "fieldname": "fg_item", "fieldtype": "Link", + "label": "Filter based on item", "options": "Item" }, { "doctype": "DocField", - "label": "Filter based on customer", "fieldname": "customer", "fieldtype": "Link", + "label": "Filter based on customer", "options": "Customer" }, { "doctype": "DocField", - "label": "Company", "fieldname": "company", "fieldtype": "Link", - "reqd": 1, - "options": "Company" + "label": "Company", + "options": "Company", + "reqd": 1 }, { "doctype": "DocField", - "width": "50%", "fieldname": "column_break1", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "width": "50%" }, { "doctype": "DocField", - "label": "From Date", "fieldname": "from_date", - "fieldtype": "Date" + "fieldtype": "Date", + "label": "From Date" }, { "doctype": "DocField", - "label": "To Date", "fieldname": "to_date", - "fieldtype": "Date" + "fieldtype": "Date", + "label": "To Date" }, { "doctype": "DocField", @@ -102,52 +102,52 @@ { "description": "Pull sales orders (pending to deliver) based on the above criteria", "doctype": "DocField", - "label": "Get Sales Orders", "fieldname": "get_sales_orders", "fieldtype": "Button", + "label": "Get Sales Orders", "options": "get_open_sales_orders" }, { "doctype": "DocField", - "label": "Production Plan Sales Orders", "fieldname": "pp_so_details", "fieldtype": "Table", + "label": "Production Plan Sales Orders", "options": "Production Plan Sales Order" }, { "doctype": "DocField", - "label": "Clear Table", "fieldname": "clear_so_table", "fieldtype": "Button", + "label": "Clear Table", "options": "clear_so_table" }, { "description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.", "doctype": "DocField", - "label": "Create Production Orders", "fieldname": "create_production_orders", - "fieldtype": "Section Break" + "fieldtype": "Section Break", + "label": "Create Production Orders" }, { "description": "Pull items from Sales Order mentioned in the above table.", "doctype": "DocField", - "label": "Get Items", "fieldname": "get_items_from_so", "fieldtype": "Button", + "label": "Get Items", "options": "get_items_from_so" }, { "doctype": "DocField", - "label": "Production Plan Items", "fieldname": "pp_details", "fieldtype": "Table", + "label": "Production Plan Items", "options": "Production Plan Item" }, { "doctype": "DocField", - "label": "Clear Table", "fieldname": "clear_item_table", "fieldtype": "Button", + "label": "Clear Table", "options": "clear_item_table" }, { @@ -157,72 +157,72 @@ "options": "Simple" }, { - "description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.", "default": "1", + "description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.", "doctype": "DocField", - "label": "Use Multi-Level BOM", "fieldname": "use_multi_level_bom", "fieldtype": "Check", + "label": "Use Multi-Level BOM", "reqd": 0 }, { "doctype": "DocField", - "width": "50%", "fieldname": "cb5", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "width": "50%" }, { "description": "Separate production order will be created for each finished good item.", "doctype": "DocField", - "label": "Raise Production Order", "fieldname": "raise_production_order", "fieldtype": "Button", + "label": "Raise Production Order", "options": "raise_production_order" }, { "doctype": "DocField", - "label": "Materials Requirement Planning (MRP)", "fieldname": "sb5", - "fieldtype": "Section Break" + "fieldtype": "Section Break", + "label": "Materials Requirement Planning (MRP)" }, { "description": "Download a report containing all raw materials with their latest inventory status", "doctype": "DocField", - "label": "Download Materials Required", "fieldname": "download_materials_required", - "fieldtype": "Button" + "fieldtype": "Button", + "label": "Download Materials Required" }, { "doctype": "DocField", - "width": "50%", "fieldname": "column_break6", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "width": "50%" }, { "doctype": "DocField", - "label": "Purchase Request For Warehouse", "fieldname": "purchase_request_for_warehouse", "fieldtype": "Link", + "label": "Material Request For Warehouse", "options": "Warehouse" }, { "description": "Items to be requested which are \"Out of Stock\" considering all warehouses based on projected qty and minimum order qty", "doctype": "DocField", - "label": "Raise Purchase Request", "fieldname": "raise_purchase_request", "fieldtype": "Button", + "label": "Raise Material Request", "options": "raise_purchase_request" }, { - "role": "System Manager", - "doctype": "DocPerm" + "doctype": "DocPerm", + "role": "System Manager" }, { - "role": "Manufacturing User", - "doctype": "DocPerm" + "doctype": "DocPerm", + "role": "Manufacturing User" }, { - "role": "Manufacturing Manager", - "doctype": "DocPerm" + "doctype": "DocPerm", + "role": "Manufacturing Manager" } ] \ No newline at end of file diff --git a/manufacturing/page/manufacturing_home/manufacturing_home.js b/manufacturing/page/manufacturing_home/manufacturing_home.js index cb4222b367b..b7f28edc411 100644 --- a/manufacturing/page/manufacturing_home/manufacturing_home.js +++ b/manufacturing/page/manufacturing_home/manufacturing_home.js @@ -20,7 +20,7 @@ wn.module_page["Manufacturing"] = [ { "route":"Form/Production Planning Tool/Production Planning Tool", "label":wn._("Production Planning Tool"), - "description":wn._("Generate Purchase Requests (MRP) and Production Orders."), + "description":wn._("Generate Material Requests (MRP) and Production Orders."), doctype: "Production Planning Tool" }, ] diff --git a/patches/february_2013/p03_material_request.py b/patches/february_2013/p03_material_request.py new file mode 100644 index 00000000000..f8c4dc1b93b --- /dev/null +++ b/patches/february_2013/p03_material_request.py @@ -0,0 +1,6 @@ +import webnotes + +def execute(): + webnotes.reload_doc("core", "doctype", "doctype") + webnotes.rename_doc("DocType", "Purchase Request Item", "Material Request Item", force=True) + webnotes.rename_doc("DocType", "Purchase Request", "Material Request", force=True) \ No newline at end of file diff --git a/patches/july_2012/reload_pr_po_mapper.py b/patches/july_2012/reload_pr_po_mapper.py index 74b68c7c01e..a53e3ddf8fd 100644 --- a/patches/july_2012/reload_pr_po_mapper.py +++ b/patches/july_2012/reload_pr_po_mapper.py @@ -2,4 +2,4 @@ from __future__ import unicode_literals def execute(): import webnotes from webnotes.modules import reload_doc - reload_doc('buying', 'DocType Mapper', 'Purchase Request-Purchase Order') \ No newline at end of file + reload_doc('buying', 'DocType Mapper', 'Material Request-Purchase Order') \ No newline at end of file diff --git a/patches/july_2012/supplier_quotation.py b/patches/july_2012/supplier_quotation.py index 84809e52ba3..49fa14dc9b7 100644 --- a/patches/july_2012/supplier_quotation.py +++ b/patches/july_2012/supplier_quotation.py @@ -10,6 +10,6 @@ def execute(): sync('buying', 'purchase_order_item') from webnotes.modules import reload_doc - reload_doc('buying', 'DocType Mapper', 'Purchase Request-Supplier Quotation') + reload_doc('buying', 'DocType Mapper', 'Material Request-Supplier Quotation') reload_doc('buying', 'DocType Mapper', 'Supplier Quotation-Purchase Order') \ No newline at end of file diff --git a/patches/mar_2012/doctype_get_refactor.py b/patches/mar_2012/doctype_get_refactor.py index 66339db1223..c6bfb3129c1 100644 --- a/patches/mar_2012/doctype_get_refactor.py +++ b/patches/mar_2012/doctype_get_refactor.py @@ -102,7 +102,7 @@ def create_file_list(): 'Project', 'Profile', 'Production Order', 'Product', 'Print Format', 'Price List', 'Purchase Invoice', 'Page', 'Maintenance Visit', 'Maintenance Schedule', 'Letter Head', - 'Leave Application', 'Lead', 'Journal Voucher', 'Item', 'Purchase Request', + 'Leave Application', 'Lead', 'Journal Voucher', 'Item', 'Material Request', 'Expense Claim', 'Opportunity', 'Employee', 'Delivery Note', 'Customer Issue', 'Customer', 'Contact Us Settings', 'Company', 'Bulk Rename Tool', 'Blog', 'BOM', 'About Us Settings'] diff --git a/patches/may_2012/rename_prev_doctype.py b/patches/may_2012/rename_prev_doctype.py index 135b81de594..9b1e0b66172 100644 --- a/patches/may_2012/rename_prev_doctype.py +++ b/patches/may_2012/rename_prev_doctype.py @@ -4,7 +4,7 @@ def execute(): dt_list = webnotes.conn.sql("select parent, fieldname from `tabDocField` where fieldname in ('against_doctype', 'prevdoc_doctype')") ren_dt = { - 'Indent' : 'Purchase Request', + 'Indent' : 'Material Request', 'Enquiry' : 'Opportunity', 'Receivable Voucher' : 'Sales Invoice', 'Payable Voucher' : 'Purchase Invoice' diff --git a/patches/may_2012/renamedt_in_custom_search_criteria.py b/patches/may_2012/renamedt_in_custom_search_criteria.py index a5f73508ded..1522deeb6be 100644 --- a/patches/may_2012/renamedt_in_custom_search_criteria.py +++ b/patches/may_2012/renamedt_in_custom_search_criteria.py @@ -8,8 +8,8 @@ def execute(): 'Payable Voucher' : 'Purchase Invoice', 'PV Detail' : 'Purchase Invoice Item', 'Purchase Tax Detail' : 'Purchase Taxes and Charges', - 'Indent' : 'Purchase Request', - 'Indent Detail' : 'Purchase Request Item', + 'Indent' : 'Material Request', + 'Indent Detail' : 'Material Request Item', 'QA Inspection Report' : 'Quality Inspection', 'Ticket' : 'Task', 'Manage Account' : 'Global Defaults', diff --git a/patches/patch_list.py b/patches/patch_list.py index 472360ed1ad..ae68b711ab7 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -173,4 +173,5 @@ patch_list = [ "patches.february_2013.p01_event", "execute:webnotes.delete_doc('Page', 'Calendar')", "patches.february_2013.p02_email_digest", + "patches.february_2013.p03_material_request", ] \ No newline at end of file diff --git a/public/js/feature_setup.js b/public/js/feature_setup.js index 769a3f0488e..0304034cf6b 100644 --- a/public/js/feature_setup.js +++ b/public/js/feature_setup.js @@ -56,7 +56,7 @@ pscript.feature_dict = { }, 'fs_brands': { 'Delivery Note': {'delivery_note_details':['brand']}, - 'Purchase Request': {'indent_details':['brand']}, + 'Material Request': {'indent_details':['brand']}, 'Item': {'fields':['brand']}, 'Purchase Order': {'po_details':['brand']}, 'Purchase Invoice': {'entries':['brand']}, @@ -101,7 +101,7 @@ pscript.feature_dict = { 'fs_item_group_in_details': { 'Delivery Note': {'delivery_note_details':['item_group']}, 'Opportunity': {'enquiry_details':['item_group']}, - 'Purchase Request': {'indent_details':['item_group']}, + 'Material Request': {'indent_details':['item_group']}, 'Item': {'fields':['item_group']}, 'Global Defaults': {'fields':['default_item_group']}, 'Purchase Order': {'po_details':['item_group']}, @@ -118,7 +118,7 @@ pscript.feature_dict = { }, 'fs_page_break': { 'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']}, - 'Purchase Request': {'indent_details':['page_break']}, + 'Material Request': {'indent_details':['page_break']}, 'Purchase Order': {'po_details':['page_break']}, 'Purchase Receipt': {'purchase_receipt_details':['page_break']}, 'Purchase Voucher': {'entries':['page_break']}, @@ -174,7 +174,7 @@ pscript.feature_dict = { 'fs_more_info': { 'Delivery Note': {'fields':['More Info']}, 'Opportunity': {'fields':['More Info']}, - 'Purchase Request': {'fields':['More Info']}, + 'Material Request': {'fields':['More Info']}, 'Lead': {'fields':['More Info']}, 'Purchase Invoice': {'fields':['More Info']}, 'Purchase Order': {'fields':['More Info']}, diff --git a/selling/doctype/sales_order/sales_order.js b/selling/doctype/sales_order/sales_order.js index 55854b5b92a..f65a68988fa 100644 --- a/selling/doctype/sales_order/sales_order.js +++ b/selling/doctype/sales_order/sales_order.js @@ -76,7 +76,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { // indent if(!doc.order_type || (doc.order_type == 'Sales')) - cur_frm.add_custom_button('Make ' + wn._('Purchase Request'), cur_frm.cscript['Make Purchase Request']); + cur_frm.add_custom_button('Make ' + wn._('Material Request'), cur_frm.cscript['Make Material Request']); // sales invoice if(flt(doc.per_billed, 2) < 100) @@ -244,19 +244,19 @@ cur_frm.cscript.make_maintenance_visit = function() { } } -cur_frm.cscript['Make Purchase Request'] = function() { +cur_frm.cscript['Make Material Request'] = function() { var doc = cur_frm.doc; if (doc.docstatus == 1) { - n = wn.model.make_new_doc_and_get_name("Purchase Request"); + n = wn.model.make_new_doc_and_get_name("Material Request"); $c('dt_map', args={ - 'docs':wn.model.compress([locals["Purchase Request"][n]]), + 'docs':wn.model.compress([locals["Material Request"][n]]), 'from_doctype':'Sales Order', - 'to_doctype':'Purchase Request', + 'to_doctype':'Material Request', 'from_docname':doc.name, - 'from_to_list':"[['Sales Order', 'Purchase Request'], ['Sales Order Item', 'Purchase Request Item']]" + 'from_to_list':"[['Sales Order', 'Material Request'], ['Sales Order Item', 'Material Request Item']]" } , function(r,rt) { - loaddoc("Purchase Request", n); + loaddoc("Material Request", n); } ); } diff --git a/setup/doctype/email_digest/email_digest.py b/setup/doctype/email_digest/email_digest.py index 01026aa6b63..9f28f132860 100644 --- a/setup/doctype/email_digest/email_digest.py +++ b/setup/doctype/email_digest/email_digest.py @@ -261,7 +261,7 @@ class DocType: return self.get_new_sum("Delivery Note", "New Delivery Notes", "grand_total") def get_new_purchase_requests(self): - return self.get_new_count("Purchase Request", "New Purchase Requests") + return self.get_new_count("Material Request", "New Material Requests") def get_new_supplier_quotations(self): return self.get_new_sum("Supplier Quotation", "New Supplier Quotations", diff --git a/setup/doctype/email_digest/email_digest.txt b/setup/doctype/email_digest/email_digest.txt index 316a840a5dd..0b40fb4b0c1 100644 --- a/setup/doctype/email_digest/email_digest.txt +++ b/setup/doctype/email_digest/email_digest.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-25 11:35:08", + "creation": "2013-02-18 13:36:19", "docstatus": 0, - "modified": "2013-02-16 14:43:52", + "modified": "2013-02-18 13:43:50", "modified_by": "Administrator", "owner": "Administrator" }, @@ -169,7 +169,7 @@ "doctype": "DocField", "fieldname": "new_purchase_requests", "fieldtype": "Check", - "label": "New Purchase Requests" + "label": "New Material Requests" }, { "doctype": "DocField", diff --git a/setup/doctype/features_setup/features_setup.txt b/setup/doctype/features_setup/features_setup.txt index 1359508c264..18a01dc913a 100644 --- a/setup/doctype/features_setup/features_setup.txt +++ b/setup/doctype/features_setup/features_setup.txt @@ -1,53 +1,42 @@ [ { - "owner": "Administrator", + "creation": "2012-12-20 12:50:49", "docstatus": 0, - "creation": "2012-04-13 11:56:31", + "modified": "2013-02-18 13:44:28", "modified_by": "Administrator", - "modified": "2012-12-10 18:30:00" + "owner": "Administrator" }, { - "section_style": "Simple", - "module": "Setup", "doctype": "DocType", "issingle": 1, + "module": "Setup", "name": "__common__", - "colour": "White:FFF", - "_last_update": "1323840127", - "show_in_menu": 1, - "name_case": "Title Case", - "version": 1 + "name_case": "Title Case" }, { - "name": "__common__", - "parent": "Features Setup", "doctype": "DocField", - "parenttype": "DocType", - "permlevel": 0, - "parentfield": "fields" - }, - { "name": "__common__", "parent": "Features Setup", - "read": 1, + "parentfield": "fields", + "parenttype": "DocType", + "permlevel": 0 + }, + { "create": 1, "doctype": "DocPerm", - "write": 1, + "name": "__common__", + "parent": "Features Setup", + "parentfield": "permissions", "parenttype": "DocType", "permlevel": 0, - "parentfield": "permissions" + "read": 1, + "report": 0, + "submit": 0, + "write": 1 }, { - "name": "Features Setup", - "doctype": "DocType" - }, - { - "role": "System Manager", - "doctype": "DocPerm" - }, - { - "role": "Administrator", - "doctype": "DocPerm" + "doctype": "DocType", + "name": "Features Setup" }, { "doctype": "DocField", @@ -57,63 +46,57 @@ }, { "description": "To track item in sales and purchase documents based on their serial nos. This is can also used to track warranty details of the product.", - "colour": "White:FFF", "doctype": "DocField", - "label": "Item Serial Nos", "fieldname": "fs_item_serial_nos", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Item Serial Nos" }, { "description": "To track items in sales and purchase documents with batch nos
Preferred Industry: Chemicals etc", - "colour": "White:FFF", "doctype": "DocField", - "label": "Item Batch Nos", "fieldname": "fs_item_batch_nos", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Item Batch Nos" }, { - "description": "To track brand name in the following documents
\nDelivery Note, Enuiry, Purchase Request, Item, Purchase Order, Purchase Voucher, Purchaser Receipt, Quotation, Sales Invoice, Sales BOM, Sales Order, Serial No", - "colour": "White:FFF", + "description": "To track brand name in the following documents
\nDelivery Note, Enuiry, Material Request, Item, Purchase Order, Purchase Voucher, Purchaser Receipt, Quotation, Sales Invoice, Sales BOM, Sales Order, Serial No", "doctype": "DocField", - "label": "Brands", "fieldname": "fs_brands", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Brands" }, { "description": "To track items using barcode. You will be able to enter items in Delivery Note and Sales Invoice by scanning barcode of item.", "doctype": "DocField", - "label": "Item Barcode", "fieldname": "fs_item_barcode", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Item Barcode" }, { + "doctype": "DocField", "fieldname": "column_break0", - "fieldtype": "Column Break", - "doctype": "DocField" + "fieldtype": "Column Break" }, { "description": "1. To maintain the customer wise item code and to make them searchable based on their code use this option", - "colour": "White:FFF", "doctype": "DocField", - "label": "Item Advanced", "fieldname": "fs_item_advanced", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Item Advanced" }, { "description": "If Sale BOM is defined, the actual BOM of the Pack is displayed as table.\nAvailable in Delivery Note and Sales Order", - "colour": "White:FFF", "doctype": "DocField", - "label": "Packing Detials", "fieldname": "fs_packing_details", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Packing Detials" }, { "description": "To get Item Group in details table", - "colour": "White:FFF", "doctype": "DocField", - "label": "Item Groups in Details", "fieldname": "fs_item_group_in_details", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Item Groups in Details" }, { "doctype": "DocField", @@ -123,63 +106,57 @@ }, { "description": "All export related fields like currency, conversion rate, export total, export grand total etc are available in
\nDelivery Note, POS, Quotation, Sales Invoice, Sales Order etc.", - "colour": "White:FFF", "doctype": "DocField", - "label": "Exports", "fieldname": "fs_exports", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Exports" }, { "description": "All import related fields like currency, conversion rate, import total, import grand total etc are available in
\nPurchase Receipt, Supplier Quotation, Purchase Invoice, Purchase Order etc.", - "colour": "White:FFF", "doctype": "DocField", - "label": "Imports", "fieldname": "fs_imports", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Imports" }, { + "doctype": "DocField", "fieldname": "column_break1", - "fieldtype": "Column Break", - "doctype": "DocField" + "fieldtype": "Column Break" }, { "description": "Field available in Delivery Note, Quotation, Sales Invoice, Sales Order", - "colour": "White:FFF", "doctype": "DocField", - "label": "Sales Discounts", "fieldname": "fs_discounts", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Sales Discounts" }, { "description": "Discount Fields will be available in Purchase Order, Purchase Receipt, Purchase Invoice", - "colour": "White:FFF", "doctype": "DocField", - "label": "Purchase Discounts", "fieldname": "fs_purchase_discounts", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Purchase Discounts" }, { "description": "To track any installation or commissioning related work after sales", - "colour": "White:FFF", "doctype": "DocField", - "label": "After Sale Installations", "fieldname": "fs_after_sales_installations", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "After Sale Installations" }, { "description": "Available in \nBOM, Delivery Note, Purchase Invoice, Production Order, Purchase Order, Purchase Receipt, Sales Invoice, Sales Order, Stock Entry, Timesheet", "doctype": "DocField", - "label": "Projects", "fieldname": "fs_projects", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Projects" }, { "description": "If you have Sales Team and Sale Partners (Channel Partners) they can be tagged and maintain their contribution in the sales activity", - "colour": "White:FFF", "doctype": "DocField", - "label": "Sales Extras", "fieldname": "fs_sales_extras", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Sales Extras" }, { "doctype": "DocField", @@ -189,24 +166,22 @@ }, { "description": "Check if you need automatic recurring invoices. After submitting any sales invoice, Recurring section will be visible.", - "colour": "White:FFF", "doctype": "DocField", - "label": "Recurring Invoice", "fieldname": "fs_recurring_invoice", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Recurring Invoice" }, { + "doctype": "DocField", "fieldname": "column_break2", - "fieldtype": "Column Break", - "doctype": "DocField" + "fieldtype": "Column Break" }, { "description": "To enable Point of Sale features", - "colour": "White:FFF", "doctype": "DocField", - "label": "Point of Sale", "fieldname": "fs_pos", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Point of Sale" }, { "doctype": "DocField", @@ -216,24 +191,22 @@ }, { "description": "If you involve in manufacturing activity
\nEnables item Is Manufactured", - "colour": "White:FFF", "doctype": "DocField", - "label": "Manufacturing", "fieldname": "fs_manufacturing", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Manufacturing" }, { + "doctype": "DocField", "fieldname": "column_break3", - "fieldtype": "Column Break", - "doctype": "DocField" + "fieldtype": "Column Break" }, { "description": "If you follow Quality Inspection
\nEnables item QA Required and QA No in Purchase Receipt", - "colour": "White:FFF", "doctype": "DocField", - "label": "Quality", "fieldname": "fs_quality", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Quality" }, { "doctype": "DocField", @@ -243,23 +216,29 @@ }, { "description": "If you have long print formats, this feature can be used to split the page to be printed on multiple pages with all headers and footers on each page", - "colour": "White:FFF", "doctype": "DocField", - "label": "Page Break", "fieldname": "fs_page_break", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Page Break" }, { + "doctype": "DocField", "fieldname": "column_break4", - "fieldtype": "Column Break", - "doctype": "DocField" + "fieldtype": "Column Break" }, { "description": "Enables More Info. in all documents", - "colour": "White:FFF", "doctype": "DocField", - "label": "More Info", "fieldname": "fs_more_info", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "More Info" + }, + { + "doctype": "DocPerm", + "role": "System Manager" + }, + { + "doctype": "DocPerm", + "role": "Administrator" } ] \ No newline at end of file diff --git a/setup/doctype/global_defaults/global_defaults.txt b/setup/doctype/global_defaults/global_defaults.txt index 3344a87f46c..f88e2eea8b7 100644 --- a/setup/doctype/global_defaults/global_defaults.txt +++ b/setup/doctype/global_defaults/global_defaults.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-29 19:25:56", + "creation": "2013-02-18 13:36:21", "docstatus": 0, - "modified": "2013-02-13 09:56:28", + "modified": "2013-02-18 13:44:56", "modified_by": "Administrator", "owner": "Administrator" }, @@ -183,7 +183,7 @@ "doctype": "DocField", "fieldname": "auto_indent", "fieldtype": "Check", - "label": "Raise Purchase Request when stock reaches re-order level" + "label": "Raise Material Request when stock reaches re-order level" }, { "default": "1", diff --git a/startup/open_count.py b/startup/open_count.py index a273151c9a3..7d8dcf87282 100644 --- a/startup/open_count.py +++ b/startup/open_count.py @@ -22,7 +22,7 @@ queries = { "Purchase Receipt": {"docstatus":0}, "Delivery Note": {"docstatus":0}, "Stock Entry": {"docstatus":0}, - "Purchase Request": {"docstatus":0}, + "Material Request": {"docstatus":0}, "Purchase Order": {"docstatus":0}, "Production Order": {"docstatus":0}, "BOM": {"docstatus":0}, diff --git a/startup/report_data_map.py b/startup/report_data_map.py index 83e4b30dcad..cbfcc018c82 100644 --- a/startup/report_data_map.py +++ b/startup/report_data_map.py @@ -112,10 +112,10 @@ data_map = { "warehouse": ["Warehouse", "name"] }, }, - "Purchase Request Item": { + "Material Request Item": { "columns": ["item.name as name", "item_code", "warehouse", "(ifnull(qty, 0) - ifnull(ordered_qty, 0)) as qty"], - "from": "`tabPurchase Request Item` item, `tabPurchase Request` main", + "from": "`tabMaterial Request Item` item, `tabMaterial Request` main", "conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'", "ifnull(warehouse, '')!=''", "ifnull(qty, 0) > ifnull(ordered_qty, 0)"], "links": { diff --git a/stock/doctype/bin/bin.py b/stock/doctype/bin/bin.py index 19ce8f9e51f..fc2736f476b 100644 --- a/stock/doctype/bin/bin.py +++ b/stock/doctype/bin/bin.py @@ -119,17 +119,17 @@ class DocType: def create_auto_indent(self, i , doc_type, doc_name, cur_qty): """ Create indent on reaching reorder level """ - indent = Document('Purchase Request') + indent = Document('Material Request') indent.transaction_date = nowdate() indent.naming_series = 'IDT' indent.company = get_defaults()['company'] indent.fiscal_year = get_defaults()['fiscal_year'] - indent.remark = """This is an auto generated Purchase Request. + indent.remark = """This is an auto generated Material Request. It was raised because the (actual + ordered + indented - reserved) quantity reaches re-order level when %s %s was created""" % (doc_type,doc_name) indent.save(1) - indent_obj = get_obj('Purchase Request',indent.name,with_children=1) - indent_details_child = addchild(indent_obj.doc,'indent_details','Purchase Request Item') + indent_obj = get_obj('Material Request',indent.name,with_children=1) + indent_details_child = addchild(indent_obj.doc,'indent_details','Material Request Item') indent_details_child.item_code = self.doc.item_code indent_details_child.uom = self.doc.stock_uom indent_details_child.warehouse = self.doc.warehouse @@ -140,11 +140,11 @@ class DocType: indent_details_child.qty = i['re_order_qty'] or (flt(i['re_order_level']) - flt(cur_qty)) indent_details_child.brand = i['brand'] indent_details_child.save() - indent_obj = get_obj('Purchase Request',indent.name,with_children=1) + indent_obj = get_obj('Material Request',indent.name,with_children=1) indent_obj.validate() webnotes.conn.set(indent_obj.doc,'docstatus',1) indent_obj.on_submit() - msgprint("""Item: %s is to be re-ordered. Purchase Request %s raised. + msgprint("""Item: %s is to be re-ordered. Material Request %s raised. It was generated from %s: %s""" % (self.doc.item_code, indent.name, doc_type, doc_name )) if(i['email_notify']): @@ -158,6 +158,6 @@ class DocType: where p.name = r.parent and p.enabled = 1 and p.docstatus < 2 and r.role in ('Purchase Manager','Material Manager') and p.name not in ('Administrator', 'All', 'Guest')""")] - msg="""A Purchase Request has been raised + msg="""A Material Request has been raised for item %s: %s on %s """ % (doc_type, doc_name, nowdate()) - sendmail(email_list, subject='Auto Purchase Request Generation Notification', msg = msg) + sendmail(email_list, subject='Auto Material Request Generation Notification', msg = msg) diff --git a/stock/doctype/item/item.txt b/stock/doctype/item/item.txt index fd963f78ced..ffa9549f182 100644 --- a/stock/doctype/item/item.txt +++ b/stock/doctype/item/item.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-21 18:19:22", + "creation": "2013-02-18 13:36:21", "docstatus": 0, - "modified": "2013-01-29 13:32:21", + "modified": "2013-02-18 13:46:29", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,14 +28,13 @@ "permlevel": 0 }, { + "amend": 0, "doctype": "DocPerm", "name": "__common__", "parent": "Item", "parentfield": "permissions", "parenttype": "DocType", - "permlevel": 0, "read": 1, - "report": 1, "submit": 0 }, { @@ -200,32 +199,6 @@ "oldfieldname": "tolerance", "oldfieldtype": "Currency" }, - { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "description": "The system will generate a Purchase Request automatically when stock quantity goes below re-order level in warehouse of type \"Stores\" or \"Reserved Warehouse\".", - "doctype": "DocField", - "fieldname": "re_order_level", - "fieldtype": "Float", - "label": "Re-Order Level", - "oldfieldname": "re_order_level", - "oldfieldtype": "Currency" - }, - { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "description": "The quantity for the Purchase Request when the stock goes below re-order level.", - "doctype": "DocField", - "fieldname": "re_order_qty", - "fieldtype": "Float", - "label": "Re-Order Qty" - }, - { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "description": "Send an email to users of role \"Material Manager\" and \"Purchase Manager\" when re-order level is crossed.", - "doctype": "DocField", - "fieldname": "email_notify", - "fieldtype": "Check", - "label": "Notify by Email on Re-order" - }, { "depends_on": "eval:doc.is_stock_item==\"Yes\"", "doctype": "DocField", @@ -327,6 +300,54 @@ "label": "Weight UOM", "options": "UOM" }, + { + "doctype": "DocField", + "fieldname": "reorder_section", + "fieldtype": "Section Break", + "label": "Re-order" + }, + { + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "doctype": "DocField", + "fieldname": "re_order_level", + "fieldtype": "Float", + "label": "Re-Order Level", + "oldfieldname": "re_order_level", + "oldfieldtype": "Currency" + }, + { + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "doctype": "DocField", + "fieldname": "re_order_qty", + "fieldtype": "Float", + "label": "Re-Order Qty" + }, + { + "doctype": "DocField", + "fieldname": "column_break_31", + "fieldtype": "Column Break" + }, + { + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "description": "Send an email to users of role \"Material Manager\" and \"Purchase Manager\" when re-order level is crossed.", + "doctype": "DocField", + "fieldname": "email_notify", + "fieldtype": "Check", + "label": "Notify by Email on Re-order" + }, + { + "doctype": "DocField", + "fieldname": "section_break_31", + "fieldtype": "Section Break", + "options": "Simple" + }, + { + "doctype": "DocField", + "fieldname": "item_reorder", + "fieldtype": "Table", + "label": "Warehouse-wise Item Reorder", + "options": "Item Reorder" + }, { "doctype": "DocField", "fieldname": "purchase_details", @@ -348,7 +369,7 @@ }, { "depends_on": "eval:doc.is_purchase_item==\"Yes\"", - "description": "Lead Time days is number of days by which this item is expected in your warehouse. This days is fetched in Purchase Request when you select this item.", + "description": "Lead Time days is number of days by which this item is expected in your warehouse. This days is fetched in Material Request when you select this item.", "doctype": "DocField", "fieldname": "lead_time_days", "fieldtype": "Int", @@ -791,18 +812,38 @@ "label": "Website Description" }, { - "amend": 0, "cancel": 0, "create": 0, "doctype": "DocPerm", + "permlevel": 1, + "report": 0, "role": "Material Manager", "write": 0 }, { - "amend": 0, "cancel": 0, "create": 0, "doctype": "DocPerm", + "permlevel": 0, + "report": 1, + "role": "Material Manager", + "write": 0 + }, + { + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "report": 0, + "role": "Material User", + "write": 0 + }, + { + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 0, + "report": 1, "role": "Material User", "write": 0 }, @@ -810,7 +851,36 @@ "cancel": 1, "create": 1, "doctype": "DocPerm", + "permlevel": 0, + "report": 1, "role": "Material Master Manager", "write": 1 + }, + { + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "report": 0, + "role": "Material Master Manager", + "write": 0 + }, + { + "cancel": 1, + "create": 1, + "doctype": "DocPerm", + "permlevel": 0, + "report": 1, + "role": "System Manager", + "write": 1 + }, + { + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "report": 0, + "role": "System Manager", + "write": 0 } ] \ No newline at end of file diff --git a/stock/doctype/item_reorder/__init__.py b/stock/doctype/item_reorder/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/stock/doctype/item_reorder/item_reorder.py b/stock/doctype/item_reorder/item_reorder.py new file mode 100644 index 00000000000..928aa9ff9f2 --- /dev/null +++ b/stock/doctype/item_reorder/item_reorder.py @@ -0,0 +1,8 @@ +# For license information, please see license.txt + +from __future__ import unicode_literals +import webnotes + +class DocType: + def __init__(self, d, dl): + self.doc, self.doclist = d, dl \ No newline at end of file diff --git a/stock/doctype/item_reorder/item_reorder.txt b/stock/doctype/item_reorder/item_reorder.txt new file mode 100644 index 00000000000..ca429aff951 --- /dev/null +++ b/stock/doctype/item_reorder/item_reorder.txt @@ -0,0 +1,56 @@ +[ + { + "creation": "2013-02-18 12:48:07", + "docstatus": 0, + "modified": "2013-02-18 12:54:46", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "autoname": "REORD-.#####", + "doctype": "DocType", + "in_create": 1, + "istable": 1, + "module": "Stock", + "name": "__common__" + }, + { + "doctype": "DocField", + "name": "__common__", + "parent": "Item Reorder", + "parentfield": "fields", + "parenttype": "DocType", + "permlevel": 0 + }, + { + "doctype": "DocType", + "name": "Item Reorder" + }, + { + "doctype": "DocField", + "fieldname": "warehouse", + "fieldtype": "Link", + "label": "Warehouse", + "options": "Warehouse", + "reqd": 1 + }, + { + "doctype": "DocField", + "fieldname": "warehouse_reorder_level", + "fieldtype": "Float", + "label": "Re-order Level" + }, + { + "doctype": "DocField", + "fieldname": "warehouse_reorder_qty", + "fieldtype": "Float", + "label": "Re-order Qty" + }, + { + "doctype": "DocField", + "fieldname": "material_request_type", + "fieldtype": "Select", + "label": "Material Request Type", + "options": "Purchase\nTransfer" + } +] \ No newline at end of file diff --git a/stock/doctype/material_request/__init__.py b/stock/doctype/material_request/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/stock/doctype/material_request/material_request.js b/stock/doctype/material_request/material_request.js new file mode 100644 index 00000000000..224fcc627e9 --- /dev/null +++ b/stock/doctype/material_request/material_request.js @@ -0,0 +1,141 @@ +// ERPNext - web based ERP (http://erpnext.com) +// Copyright (C) 2012 Web Notes Technologies Pvt Ltd +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +cur_frm.cscript.tname = "Material Request Item"; +cur_frm.cscript.fname = "indent_details"; + +wn.require('app/buying/doctype/purchase_common/purchase_common.js'); +wn.require('app/utilities/doctype/sms_control/sms_control.js'); + +erpnext.buying.PurchaseRequestController = erpnext.buying.BuyingController.extend({ + refresh: function(doc) { + this._super(); + + if(doc.docstatus == 1 && doc.status != 'Stopped'){ + cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation); + if(flt(doc.per_ordered, 2) < 100) { + cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order']); + cur_frm.add_custom_button('Stop Material Request', cur_frm.cscript['Stop Material Request']); + } + cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); + + } + + if(doc.docstatus == 1 && doc.status == 'Stopped') + cur_frm.add_custom_button('Unstop Material Request', cur_frm.cscript['Unstop Material Request']) + } +}); + +var new_cscript = new erpnext.buying.PurchaseRequestController({frm: cur_frm}); + +// for backward compatibility: combine new and previous states +$.extend(cur_frm.cscript, new_cscript); + + +//========================== On Load ================================================= +cur_frm.cscript.onload = function(doc, cdt, cdn) { + if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date()) + if (!doc.status) doc.status = 'Draft'; + + // defined in purchase_common.js + //cur_frm.cscript.update_item_details(doc, cdt, cdn); +} + +cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) { + // second call + if(doc.__islocal){ + cur_frm.cscript.get_item_defaults(doc); + } +} + +cur_frm.cscript.get_item_defaults = function(doc) { + var ch = getchildren( 'Material Request Item', doc.name, 'indent_details'); + if (flt(ch.length) > 0){ + $c_obj(make_doclist(doc.doctype, doc.name), 'get_item_defaults', '', function(r, rt) {refresh_field('indent_details'); }); + } +} + +//======================= transaction date ============================= +cur_frm.cscript.transaction_date = function(doc,cdt,cdn){ + if(doc.__islocal){ + cur_frm.cscript.get_default_schedule_date(doc); + } +} + +//=================== Quantity =================================================================== +cur_frm.cscript.qty = function(doc, cdt, cdn) { + var d = locals[cdt][cdn]; + if (flt(d.qty) < flt(d.min_order_qty)) + alert("Warning: Material Requested Qty is less than Minimum Order Qty"); +} + +// On Button Click Functions +// ------------------------------------------------------------------------------ + +// Make Purchase Order +cur_frm.cscript['Make Purchase Order'] = function() { + var doc = cur_frm.doc; + n = wn.model.make_new_doc_and_get_name('Purchase Order'); + $c('dt_map', args={ + 'docs':wn.model.compress([locals['Purchase Order'][n]]), + 'from_doctype':doc.doctype, + 'to_doctype':'Purchase Order', + 'from_docname':doc.name, + 'from_to_list':"[['Material Request','Purchase Order'],['Material Request Item','Purchase Order Item']]" + }, function(r,rt) { + loaddoc('Purchase Order', n); + } + ); +} + +// Stop INDENT +// ================================================================================================== +cur_frm.cscript['Stop Material Request'] = function() { + var doc = cur_frm.doc; + var check = confirm("Do you really want to STOP this Material Request?"); + + if (check) { + $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) { + cur_frm.refresh(); + }); + } +} + +// Un Stop INDENT +//==================================================================================================== +cur_frm.cscript['Unstop Material Request'] = function(){ + var doc = cur_frm.doc + var check = confirm("Do you really want to UNSTOP this Material Request?"); + + if (check) { + $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) { + cur_frm.refresh(); + + }); + } +} + +cur_frm.cscript.make_supplier_quotation = function() { + var new_sq_name = wn.model.make_new_doc_and_get_name("Supplier Quotation"); + $c("dt_map", { + "docs": wn.model.compress([locals['Supplier Quotation'][new_sq_name]]), + "from_doctype": cur_frm.doc.doctype, + "to_doctype": "Supplier Quotation", + "from_docname": cur_frm.doc.name, + "from_to_list": JSON.stringify([['Material Request', 'Supplier Quotation'], + ['Material Request Item', 'Supplier Quotation Item']]), + }, function(r, rt) { loaddoc("Supplier Quotation", new_sq_name) }); +} \ No newline at end of file diff --git a/stock/doctype/material_request/material_request.py b/stock/doctype/material_request/material_request.py new file mode 100644 index 00000000000..c2cadda8373 --- /dev/null +++ b/stock/doctype/material_request/material_request.py @@ -0,0 +1,181 @@ +# ERPNext - web based ERP (http://erpnext.com) +# For license information, please see license.txt + +from __future__ import unicode_literals +import webnotes + +from webnotes.utils import cstr, flt, get_defaults +from webnotes.model.wrapper import getlist +from webnotes.model.code import get_obj +from webnotes import msgprint + +from controllers.buying_controller import BuyingController +class DocType(BuyingController): + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist + self.defaults = get_defaults() + self.tname = 'Material Request Item' + self.fname = 'indent_details' + + def get_default_schedule_date(self): + get_obj(dt = 'Purchase Common').get_default_schedule_date(self) + + # get available qty at warehouse + def get_bin_details(self, arg = ''): + return get_obj(dt='Purchase Common').get_bin_details(arg) + + # Pull Sales Order Items + # ------------------------- + def pull_so_details(self): + self.check_if_already_pulled() + if self.doc.sales_order_no: + get_obj('DocType Mapper', 'Sales Order-Material Request', with_children=1).dt_map('Sales Order', 'Material Request', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Material Request'],['Sales Order Item', 'Material Request Item']]") + self.get_item_defaults() + else: + msgprint("Please select Sales Order whose details need to pull") + + def check_if_already_pulled(self): + pass#if self.[d.sales_order_no for d in getlist(self.doclist, 'indent_details')] + + + # Get item's other details + #- ------------------------ + def get_item_defaults(self): + self.get_default_schedule_date() + for d in getlist(self.doclist, 'indent_details'): + det = webnotes.conn.sql("select min_order_qty from tabItem where name = '%s'" % d.item_code) + d.min_order_qty = det and flt(det[0][0]) or 0 + + # Validate so items + # ---------------------------- + def validate_qty_against_so(self): + so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}} + for d in getlist(self.doclist, 'indent_details'): + if d.sales_order_no: + if not so_items.has_key(d.sales_order_no): + so_items[d.sales_order_no] = {d.item_code: flt(d.qty)} + else: + if not so_items[d.sales_order_no].has_key(d.item_code): + so_items[d.sales_order_no][d.item_code] = flt(d.qty) + else: + so_items[d.sales_order_no][d.item_code] += flt(d.qty) + + for so_no in so_items.keys(): + for item in so_items[so_no].keys(): + already_indented = webnotes.conn.sql("select sum(qty) from `tabMaterial Request Item` where item_code = '%s' and sales_order_no = '%s' and docstatus = 1 and parent != '%s'" % (item, so_no, self.doc.name)) + already_indented = already_indented and flt(already_indented[0][0]) or 0 + + actual_so_qty = webnotes.conn.sql("select sum(qty) from `tabSales Order Item` where parent = '%s' and item_code = '%s' and docstatus = 1 group by parent" % (so_no, item)) + actual_so_qty = actual_so_qty and flt(actual_so_qty[0][0]) or 0 + + if flt(so_items[so_no][item]) + already_indented > actual_so_qty: + msgprint("You can raise indent of maximum qty: %s for item: %s against sales order: %s\n Anyway, you can add more qty in new row for the same item." % (actual_so_qty - already_indented, item, so_no), raise_exception=1) + + + # Validate fiscal year + # ---------------------------- + def validate_fiscal_year(self): + get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Material Request Date') + + # GET TERMS & CONDITIONS + #----------------------------- + def get_tc_details(self): + return get_obj('Purchase Common').get_tc_details(self) + + # Validate Schedule Date + #-------------------------------- + def validate_schedule_date(self): + #:::::::: validate schedule date v/s indent date :::::::::::: + for d in getlist(self.doclist, 'indent_details'): + if d.schedule_date < self.doc.transaction_date: + msgprint("Expected Schedule Date cannot be before Material Request Date") + raise Exception + + # Validate + # --------------------- + def validate(self): + super(DocType, self).validate() + + self.validate_schedule_date() + self.validate_fiscal_year() + + if not self.doc.status: + self.doc.status = "Draft" + + import utilities + utilities.validate_status(self.doc.status, ["Draft", "Submitted", "Stopped", + "Cancelled"]) + + # Get Purchase Common Obj + pc_obj = get_obj(dt='Purchase Common') + + + # Validate for items + pc_obj.validate_for_items(self) + + # Validate qty against SO + self.validate_qty_against_so() + + + def update_bin(self, is_submit, is_stopped): + """ Update Quantity Requested for Purchase in Bin""" + + for d in getlist(self.doclist, 'indent_details'): + if webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == "Yes": + if not d.warehouse: + msgprint("Please Enter Warehouse for Item %s as it is stock item" + % cstr(d.item_code), raise_exception=1) + + qty =flt(d.qty) + if is_stopped: + qty = (d.qty > d.ordered_qty) and flt(flt(d.qty) - flt(d.ordered_qty)) or 0 + + args = { + "item_code": d.item_code, + "indented_qty": (is_submit and 1 or -1) * flt(qty), + "posting_date": self.doc.transaction_date + } + get_obj('Warehouse', d.warehouse).update_bin(args) + + def on_submit(self): + purchase_controller = webnotes.get_obj("Purchase Common") + purchase_controller.is_item_table_empty(self) + + webnotes.conn.set(self.doc,'status','Submitted') + self.update_bin(is_submit = 1, is_stopped = 0) + + def check_modified_date(self): + mod_db = webnotes.conn.sql("select modified from `tabMaterial Request` where name = '%s'" % self.doc.name) + date_diff = webnotes.conn.sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified))) + + if date_diff and date_diff[0][0]: + msgprint(cstr(self.doc.doctype) +" => "+ cstr(self.doc.name) +" has been modified. Please Refresh. ") + raise Exception + + def update_status(self, status): + self.check_modified_date() + # Step 1:=> Update Bin + self.update_bin(is_submit = (status == 'Submitted') and 1 or 0, is_stopped = 1) + + # Step 2:=> Set status + webnotes.conn.set(self.doc,'status',cstr(status)) + + # Step 3:=> Acknowledge User + msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s." % ((status == 'Submitted') and 'Unstopped' or cstr(status)) ) + + + def on_cancel(self): + # Step 1:=> Get Purchase Common Obj + pc_obj = get_obj(dt='Purchase Common') + + # Step 2:=> Check for stopped status + pc_obj.check_for_stopped_status( self.doc.doctype, self.doc.name) + + # Step 3:=> Check if Purchase Order has been submitted against current Material Request + pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'Purchase Order Item') + # Step 4:=> Update Bin + self.update_bin(is_submit = 0, is_stopped = (cstr(self.doc.status) == 'Stopped') and 1 or 0) + + # Step 5:=> Set Status + webnotes.conn.set(self.doc,'status','Cancelled') diff --git a/stock/doctype/material_request/material_request.txt b/stock/doctype/material_request/material_request.txt new file mode 100644 index 00000000000..45dd4167d59 --- /dev/null +++ b/stock/doctype/material_request/material_request.txt @@ -0,0 +1,427 @@ +[ + { + "creation": "2013-01-29 19:25:55", + "docstatus": 0, + "modified": "2013-02-18 13:10:37", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "allow_attach": 1, + "allow_print": 0, + "autoname": "naming_series:", + "doctype": "DocType", + "is_submittable": 1, + "module": "Stock", + "name": "__common__", + "read_only_onload": 1, + "search_fields": "status,transaction_date,sales_order_no" + }, + { + "doctype": "DocField", + "name": "__common__", + "parent": "Material Request", + "parentfield": "fields", + "parenttype": "DocType", + "permlevel": 0 + }, + { + "doctype": "DocPerm", + "name": "__common__", + "parent": "Material Request", + "parentfield": "permissions", + "parenttype": "DocType", + "read": 1 + }, + { + "doctype": "DocType", + "name": "Material Request" + }, + { + "description": "To manage multiple series please go to Setup > Manage Series", + "doctype": "DocField", + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "MREQ\nIDT", + "print_hide": 1, + "reqd": 1 + }, + { + "description": "The date at which current entry is made in system.", + "doctype": "DocField", + "fieldname": "transaction_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Transaction Date", + "no_copy": 1, + "oldfieldname": "transaction_date", + "oldfieldtype": "Date", + "print_width": "100px", + "reqd": 1, + "search_index": 1, + "width": "100px" + }, + { + "doctype": "DocField", + "fieldname": "items", + "fieldtype": "Section Break", + "label": "Items", + "oldfieldtype": "Section Break" + }, + { + "allow_on_submit": 1, + "doctype": "DocField", + "fieldname": "indent_details", + "fieldtype": "Table", + "label": "Material Request Items", + "no_copy": 0, + "oldfieldname": "indent_details", + "oldfieldtype": "Table", + "options": "Material Request Item" + }, + { + "doctype": "DocField", + "fieldname": "section_break1", + "fieldtype": "Section Break", + "options": "Simple" + }, + { + "doctype": "DocField", + "fieldname": "column_break4", + "fieldtype": "Column Break", + "print_width": "50%", + "width": "50%" + }, + { + "description": "One or multiple Sales Order no which generated this Purchase Requisition", + "doctype": "DocField", + "fieldname": "sales_order_no", + "fieldtype": "Link", + "label": "Sales Order No", + "no_copy": 1, + "oldfieldname": "sales_order_no", + "oldfieldtype": "Data", + "options": "Sales Order", + "print_width": "100px", + "width": "100px" + }, + { + "doctype": "DocField", + "fieldname": "column_break5", + "fieldtype": "Column Break", + "print_width": "50%", + "width": "50%" + }, + { + "doctype": "DocField", + "fieldname": "pull_sales_order_details", + "fieldtype": "Button", + "label": "Pull Sales Order Items", + "options": "pull_so_details" + }, + { + "default": "Give additional details about the indent.", + "description": "Filing in Additional Information about the Purchase Requisition will help you analyze your data better.", + "doctype": "DocField", + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "oldfieldtype": "Section Break" + }, + { + "doctype": "DocField", + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "print_width": "50%", + "width": "50%" + }, + { + "description": "Select the relevant company name if you have multiple companies", + "doctype": "DocField", + "fieldname": "company", + "fieldtype": "Link", + "in_filter": 1, + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "print_hide": 1, + "print_width": "150px", + "reqd": 1, + "search_index": 1, + "width": "150px" + }, + { + "doctype": "DocField", + "fieldname": "fiscal_year", + "fieldtype": "Select", + "in_filter": 1, + "label": "Fiscal Year", + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "link:Fiscal Year", + "print_hide": 1, + "print_width": "150px", + "reqd": 1, + "search_index": 1, + "width": "150px" + }, + { + "description": "Name of the entity who has requested for the Purchase Requisition", + "doctype": "DocField", + "fieldname": "requested_by", + "fieldtype": "Data", + "in_list_view": 0, + "label": "Requested By", + "no_copy": 1, + "oldfieldname": "requested_by", + "oldfieldtype": "Data", + "print_width": "100px", + "width": "100px" + }, + { + "description": "After cancelling the Purchase Requisition, a dialog box will ask you reason for cancellation which will be reflected in this field", + "doctype": "DocField", + "fieldname": "cancel_reason", + "fieldtype": "Data", + "label": "Cancel Reason", + "no_copy": 1, + "oldfieldname": "cancel_reason", + "oldfieldtype": "Data", + "print_hide": 1, + "read_only": 1 + }, + { + "doctype": "DocField", + "fieldname": "column_break2", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "print_width": "50%", + "width": "50%" + }, + { + "allow_on_submit": 1, + "doctype": "DocField", + "fieldname": "letter_head", + "fieldtype": "Select", + "label": "Letter Head", + "oldfieldname": "letter_head", + "oldfieldtype": "Select", + "options": "link:Letter Head", + "print_hide": 1 + }, + { + "doctype": "DocField", + "fieldname": "status", + "fieldtype": "Select", + "in_filter": 1, + "in_list_view": 1, + "label": "Status", + "no_copy": 1, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "\nDraft\nSubmitted\nStopped\nCancelled", + "print_hide": 1, + "print_width": "100px", + "read_only": 1, + "reqd": 0, + "search_index": 1, + "width": "100px" + }, + { + "description": "% of materials ordered against this Purchase Requisition", + "doctype": "DocField", + "fieldname": "per_ordered", + "fieldtype": "Percent", + "in_list_view": 1, + "label": "% Ordered", + "no_copy": 1, + "oldfieldname": "per_ordered", + "oldfieldtype": "Currency", + "print_hide": 1, + "read_only": 1 + }, + { + "doctype": "DocField", + "fieldname": "amended_from", + "fieldtype": "Data", + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Data", + "print_hide": 1, + "print_width": "150px", + "read_only": 1, + "width": "150px" + }, + { + "description": "The date at which current entry is corrected in the system.", + "doctype": "DocField", + "fieldname": "amendment_date", + "fieldtype": "Date", + "label": "Amendment Date", + "no_copy": 1, + "oldfieldname": "amendment_date", + "oldfieldtype": "Date", + "print_hide": 1, + "print_width": "100px", + "width": "100px" + }, + { + "doctype": "DocField", + "fieldname": "remark", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Remarks", + "no_copy": 1, + "oldfieldname": "remark", + "oldfieldtype": "Small Text", + "print_hide": 0, + "print_width": "150px", + "width": "150px" + }, + { + "description": "Add Terms and Conditions for the Purchase Requisition. You can also prepare a Terms and Conditions Master and use the Template", + "doctype": "DocField", + "fieldname": "terms_section_break", + "fieldtype": "Section Break", + "label": "Terms and Conditions", + "oldfieldtype": "Section Break" + }, + { + "doctype": "DocField", + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Select Terms and Conditions", + "oldfieldname": "tc_name", + "oldfieldtype": "Link", + "options": "Terms and Conditions", + "print_hide": 1, + "report_hide": 1 + }, + { + "doctype": "DocField", + "fieldname": "get_terms", + "fieldtype": "Button", + "label": "Get Terms and Conditions", + "oldfieldtype": "Button", + "options": "get_tc_details" + }, + { + "doctype": "DocField", + "fieldname": "terms", + "fieldtype": "Text Editor", + "label": "Terms and Conditions Content", + "oldfieldname": "terms", + "oldfieldtype": "Text Editor" + }, + { + "allow_on_submit": 1, + "doctype": "DocField", + "fieldname": "select_print_heading", + "fieldtype": "Select", + "label": "Select Print Heading", + "options": "Print Heading", + "print_hide": 1 + }, + { + "doctype": "DocField", + "fieldname": "file_list", + "fieldtype": "Text", + "hidden": 1, + "label": "File List", + "no_copy": 1, + "print_hide": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "report": 0, + "role": "Purchase Manager", + "submit": 0, + "write": 0 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "doctype": "DocPerm", + "permlevel": 0, + "report": 1, + "role": "Purchase Manager", + "submit": 1, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "report": 0, + "role": "Material Manager", + "submit": 0, + "write": 0 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "doctype": "DocPerm", + "permlevel": 0, + "report": 1, + "role": "Material Manager", + "submit": 1, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "report": 0, + "role": "Material User", + "submit": 0, + "write": 0 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "doctype": "DocPerm", + "permlevel": 0, + "report": 1, + "role": "Material User", + "submit": 1, + "write": 1 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "doctype": "DocPerm", + "permlevel": 0, + "report": 1, + "role": "Purchase User", + "submit": 1, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "role": "Purchase User", + "submit": 0 + } +] \ No newline at end of file diff --git a/stock/doctype/material_request_item/__init__.py b/stock/doctype/material_request_item/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/stock/doctype/material_request_item/material_request_item.py b/stock/doctype/material_request_item/material_request_item.py new file mode 100644 index 00000000000..928aa9ff9f2 --- /dev/null +++ b/stock/doctype/material_request_item/material_request_item.py @@ -0,0 +1,8 @@ +# For license information, please see license.txt + +from __future__ import unicode_literals +import webnotes + +class DocType: + def __init__(self, d, dl): + self.doc, self.doclist = d, dl \ No newline at end of file diff --git a/stock/doctype/material_request_item/material_request_item.txt b/stock/doctype/material_request_item/material_request_item.txt new file mode 100644 index 00000000000..fa927cac3bf --- /dev/null +++ b/stock/doctype/material_request_item/material_request_item.txt @@ -0,0 +1,207 @@ +[ + { + "creation": "2013-02-04 10:34:46", + "docstatus": 0, + "modified": "2013-02-18 13:12:44", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "autoname": "MREQD-.#####", + "doctype": "DocType", + "istable": 1, + "module": "Stock", + "name": "__common__" + }, + { + "doctype": "DocField", + "name": "__common__", + "parent": "Material Request Item", + "parentfield": "fields", + "parenttype": "DocType", + "permlevel": 0 + }, + { + "doctype": "DocType", + "name": "Material Request Item" + }, + { + "allow_on_submit": 0, + "doctype": "DocField", + "fieldname": "schedule_date", + "fieldtype": "Date", + "label": "Required Date", + "no_copy": 1, + "oldfieldname": "schedule_date", + "oldfieldtype": "Date", + "print_hide": 0, + "reqd": 1, + "width": "100px" + }, + { + "doctype": "DocField", + "fieldname": "item_code", + "fieldtype": "Link", + "in_filter": 1, + "label": "Item Code", + "oldfieldname": "item_code", + "oldfieldtype": "Link", + "options": "Item", + "reqd": 1, + "search_index": 1, + "width": "100px" + }, + { + "doctype": "DocField", + "fieldname": "description", + "fieldtype": "Text", + "label": "Description", + "oldfieldname": "description", + "oldfieldtype": "Text", + "reqd": 1, + "width": "250px" + }, + { + "doctype": "DocField", + "fieldname": "warehouse", + "fieldtype": "Link", + "label": "Warehouse", + "oldfieldname": "warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "print_hide": 0, + "reqd": 0, + "width": "100px" + }, + { + "default": "0.00", + "doctype": "DocField", + "fieldname": "qty", + "fieldtype": "Float", + "label": "Quantity", + "no_copy": 0, + "oldfieldname": "qty", + "oldfieldtype": "Currency", + "reqd": 1, + "width": "80px" + }, + { + "doctype": "DocField", + "fieldname": "uom", + "fieldtype": "Link", + "label": "Stock UOM", + "no_copy": 0, + "oldfieldname": "uom", + "oldfieldtype": "Link", + "options": "UOM", + "read_only": 1, + "reqd": 1, + "width": "70px" + }, + { + "doctype": "DocField", + "fieldname": "lead_time_date", + "fieldtype": "Date", + "label": "Lead Time Date", + "no_copy": 1, + "oldfieldname": "lead_time_date", + "oldfieldtype": "Date", + "print_hide": 1, + "read_only": 1 + }, + { + "doctype": "DocField", + "fieldname": "item_name", + "fieldtype": "Data", + "in_filter": 1, + "label": "Item Name", + "oldfieldname": "item_name", + "oldfieldtype": "Data", + "reqd": 1, + "search_index": 1, + "width": "100px" + }, + { + "doctype": "DocField", + "fieldname": "item_group", + "fieldtype": "Link", + "in_filter": 1, + "label": "Item Group", + "no_copy": 0, + "oldfieldname": "item_group", + "oldfieldtype": "Link", + "options": "Item Group", + "print_hide": 1, + "read_only": 1, + "reqd": 0, + "search_index": 1 + }, + { + "doctype": "DocField", + "fieldname": "brand", + "fieldtype": "Link", + "label": "Brand", + "oldfieldname": "brand", + "oldfieldtype": "Link", + "options": "Brand", + "print_hide": 1, + "read_only": 1, + "width": "100px" + }, + { + "doctype": "DocField", + "fieldname": "min_order_qty", + "fieldtype": "Float", + "label": "Min Order Qty", + "no_copy": 1, + "oldfieldname": "min_order_qty", + "oldfieldtype": "Currency", + "print_hide": 1, + "read_only": 1, + "reqd": 0, + "width": "70px" + }, + { + "doctype": "DocField", + "fieldname": "projected_qty", + "fieldtype": "Float", + "label": "Projected Qty", + "no_copy": 1, + "oldfieldname": "projected_qty", + "oldfieldtype": "Currency", + "print_hide": 1, + "read_only": 1, + "width": "70px" + }, + { + "doctype": "DocField", + "fieldname": "ordered_qty", + "fieldtype": "Float", + "label": "Ordered Qty", + "no_copy": 1, + "oldfieldname": "ordered_qty", + "oldfieldtype": "Currency", + "read_only": 1 + }, + { + "doctype": "DocField", + "fieldname": "sales_order_no", + "fieldtype": "Link", + "label": "Sales Order No", + "no_copy": 1, + "options": "Sales Order", + "print_hide": 1, + "read_only": 1 + }, + { + "allow_on_submit": 1, + "doctype": "DocField", + "fieldname": "page_break", + "fieldtype": "Check", + "label": "Page Break", + "no_copy": 1, + "oldfieldname": "page_break", + "oldfieldtype": "Check", + "print_hide": 1 + } +] \ No newline at end of file diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py index 600be7fc873..94d20399954 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/stock/doctype/purchase_receipt/purchase_receipt.py @@ -297,7 +297,7 @@ class DocType(BuyingController): # 4.Update Bin self.update_stock(is_submit = 0) - # 5.Update Purchase Requests Pending Qty and accordingly it's Status + # 5.Update Material Requests Pending Qty and accordingly it's Status pc_obj.update_prevdoc_detail(self, is_submit = 0) # 6. Update last purchase rate diff --git a/stock/doctype/warehouse/warehouse.py b/stock/doctype/warehouse/warehouse.py index fb6fc298e26..380adaa8056 100644 --- a/stock/doctype/warehouse/warehouse.py +++ b/stock/doctype/warehouse/warehouse.py @@ -158,7 +158,7 @@ class DocType: def repost_indented_qty(self, bin): indented_qty = webnotes.conn.sql("""select sum(pr_item.qty - pr_item.ordered_qty) - from `tabPurchase Request Item` pr_item, `tabPurchase Request` pr + from `tabMaterial Request Item` pr_item, `tabMaterial Request` pr where pr_item.item_code=%s and pr_item.warehouse=%s and pr_item.qty > pr_item.ordered_qty and pr_item.parent=pr.name and pr.status!='Stopped' and pr.docstatus=1""" diff --git a/stock/page/stock_level/stock_level.js b/stock/page/stock_level/stock_level.js index 3455e2b48ab..3607b00fa48 100644 --- a/stock/page/stock_level/stock_level.js +++ b/stock/page/stock_level/stock_level.js @@ -40,7 +40,7 @@ erpnext.StockLevel = erpnext.StockGridReport.extend({ parent: $(wrapper).find('.layout-main'), appframe: wrapper.appframe, doctypes: ["Item", "Warehouse", "Stock Ledger Entry", "Production Order", - "Purchase Request Item", "Purchase Order Item", "Sales Order Item", "Brand"], + "Material Request Item", "Purchase Order Item", "Sales Order Item", "Brand"], }); this.wrapper.bind("make", function() { @@ -164,7 +164,7 @@ erpnext.StockLevel = erpnext.StockGridReport.extend({ $.each([ ["Stock Ledger Entry", "actual_qty"], ["Production Order", "planned_qty"], - ["Purchase Request Item", "requested_qty"], + ["Material Request Item", "requested_qty"], ["Purchase Order Item", "ordered_qty"], ["Sales Order Item", "reserved_qty"]], function(i, v) { diff --git a/utilities/cleanup_data.py b/utilities/cleanup_data.py index 8c3b00acb96..a9cc5c340e8 100644 --- a/utilities/cleanup_data.py +++ b/utilities/cleanup_data.py @@ -24,7 +24,7 @@ def delete_transactions(): 'Stock Entry','Sales Order','Salary Slip','Sales Invoice','Quotation', 'Quality Inspection', \ 'Purchase Receipt','Purchase Order','Production Order', 'POS Setting','Period Closing Voucher', \ 'Purchase Invoice','Maintenance Visit','Maintenance Schedule','Leave Application', \ - 'Leave Allocation', 'Lead', 'Journal Voucher', 'Installation Note','Purchase Request', \ + 'Leave Allocation', 'Lead', 'Journal Voucher', 'Installation Note','Material Request', \ 'GL Entry','Expense Claim','Opportunity','Delivery Note','Customer Issue','Bin', \ 'Authorization Rule','Attendance', 'C-Form', 'Form 16A', 'Lease Agreement', \ 'Lease Installment', 'TDS Payment', 'TDS Return Acknowledgement', 'Appraisal', \ diff --git a/utilities/doctype/sms_control/sms_control.js b/utilities/doctype/sms_control/sms_control.js index 4af96b3619b..f470f960ff8 100644 --- a/utilities/doctype/sms_control/sms_control.js +++ b/utilities/doctype/sms_control/sms_control.js @@ -89,7 +89,7 @@ cur_frm.cscript.send_sms = function(doc,dt,dn) { + (doc.po_no ? (' for your PO: ' + doc.po_no) : ''), 'Sales Invoice': 'Invoice ' + doc.name + ' has been sent via email ' + (doc.po_no ? (' for your PO: ' + doc.po_no) : ''), - 'Purchase Request' : 'Purchase Request ' + doc.name + ' has been raised in the system', + 'Material Request' : 'Material Request ' + doc.name + ' has been raised in the system', 'Purchase Order' : 'Purchase Order ' + doc.name + ' has been sent via email', 'Purchase Receipt' : 'Items has been received against purchase receipt: ' + doc.name } @@ -102,6 +102,6 @@ cur_frm.cscript.send_sms = function(doc,dt,dn) { sms_man.show('', '', '', doc.mobile_no, default_msg[doc.doctype]); else if (doc.doctype == 'Opportunity') sms_man.show('', '', '', doc.contact_no, default_msg[doc.doctype]); - else if (doc.doctype == 'Purchase Request') + else if (doc.doctype == 'Material Request') sms_man.show('', '', '', '', default_msg[doc.doctype]); }