From d7cc47e3ac59c9876957c70211d202fae154b17d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 10 Feb 2014 17:39:12 +0530 Subject: [PATCH] Do not validate Material Request against Sales Order, Moved Setup page to Framework --- erpnext/buying/utils.py | 5 +- erpnext/selling/utils.py | 5 +- erpnext/setup/page/setup/__init__.py | 1 - erpnext/setup/page/setup/setup.js | 30 -- erpnext/setup/page/setup/setup.py | 275 ------------------ erpnext/setup/page/setup/setup.txt | 32 -- .../material_request/material_request.py | 6 +- 7 files changed, 10 insertions(+), 344 deletions(-) delete mode 100644 erpnext/setup/page/setup/__init__.py delete mode 100644 erpnext/setup/page/setup/setup.js delete mode 100644 erpnext/setup/page/setup/setup.py delete mode 100644 erpnext/setup/page/setup/setup.txt diff --git a/erpnext/buying/utils.py b/erpnext/buying/utils.py index 1bb31544e8..d686b71d26 100644 --- a/erpnext/buying/utils.py +++ b/erpnext/buying/utils.py @@ -119,8 +119,9 @@ def _get_supplier_part_no(args, item_bean): return item_supplier and item_supplier[0].supplier_part_no or None def _validate_item_details(args, item): - from erpnext.utilities.transaction_base import validate_item_fetch - validate_item_fetch(args, item) + # TODO + # from erpnext.utilities.transaction_base import validate_item_fetch + # validate_item_fetch(args, item) # validate if purchase item or subcontracted item if item.is_purchase_item != "Yes": diff --git a/erpnext/selling/utils.py b/erpnext/selling/utils.py index ed3711d32c..dbb691df49 100644 --- a/erpnext/selling/utils.py +++ b/erpnext/selling/utils.py @@ -105,8 +105,9 @@ def _get_item_code(barcode=None, serial_no=None): return item_code[0] def _validate_item_details(args, item): - from erpnext.utilities.transaction_base import validate_item_fetch - validate_item_fetch(args, item) + # TODO + # from erpnext.utilities.transaction_base import validate_item_fetch + # validate_item_fetch(args, item) # validate if sales item or service item if args.order_type == "Maintenance": diff --git a/erpnext/setup/page/setup/__init__.py b/erpnext/setup/page/setup/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/erpnext/setup/page/setup/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/erpnext/setup/page/setup/setup.js b/erpnext/setup/page/setup/setup.js deleted file mode 100644 index 9c7395d4f7..0000000000 --- a/erpnext/setup/page/setup/setup.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors -// License: GNU General Public License v3. See license.txt - -wn.pages['Setup'].onload = function(wrapper) { - if(msg_dialog && msg_dialog.display) msg_dialog.hide(); - wn.ui.make_app_page({ - parent: wrapper, - title: wn._('Setup'), - single_column: true - }); - - wrapper.appframe.add_module_icon("Setup"); - wrapper.appframe.set_title_right(wn._("Refresh"), function() { - wn.setup.make(wrapper); - }); - - wn.setup.make(wrapper); - -} - -wn.setup = { - make: function(wrapper) { - wn.call({ - method: "webnotes.core.page.setup.setup.get", - callback: function(r) { - wrapper.find(".layout-main").empty().html(r.message); - } - }) - } -} diff --git a/erpnext/setup/page/setup/setup.py b/erpnext/setup/page/setup/setup.py deleted file mode 100644 index 5e66d0a469..0000000000 --- a/erpnext/setup/page/setup/setup.py +++ /dev/null @@ -1,275 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import webnotes, json -from webnotes import _ - -@webnotes.whitelist() -def get(): - setup = [] - for app in webnotes.get_installed_apps(): - setupfilename = webnotes.get_app_path(app, "setup.json") - if os.path.exists(setupfilename): - with open(setupfilename, "r") as f: - setup.append(json.loads(f)) - - return setup - - -items = [ - { - "type": "Section", - "title": _("Organization"), - "icon": "icon-building" - }, - {"doctype":"Company"}, - {"doctype":"Fiscal Year"}, - {"doctype":"Currency", "filter": {"enabled": 1}}, - { - "type": "Section", - "title": _("Users and Permissions"), - "icon": "icon-user" - }, - { - "doctype":"Profile", - }, - { - "doctype":"Role", - }, - { "title": _("Permission Manager"), - "route": "permission-manager", "type": "Link", "icon": "icon-shield" }, - { "title": _("User Properties"), - "route": "user-properties", "type": "Link", "icon": "icon-user" }, - { - "type": "Section", - "title": _("Master Data"), - "icon": "icon-star" - }, - { - "doctype": "Item", - "dependencies": [ - {"doctype":"Item Group", "tree": "Sales Browser"}, - {"doctype":"Warehouse"}, - {"doctype":"UOM"}, - {"doctype":"Brand"}, - {"doctype":"Price List"}, - {"doctype": "Item Price"}, - { "title": _("Stock Settings"), - "route": "Form/Stock Settings", "type": "Link", "icon": "icon-cog" }, - ], - }, - { - "doctype": "Customer", - "dependencies": [ - {"doctype":"Customer Group", "tree": "Sales Browser"}, - {"doctype":"Territory", "tree": "Sales Browser"}, - {"doctype":"Sales Person", "tree": "Sales Browser"}, - {"doctype":"Contact", "query": "select count(*) from `tabContact` where ifnull(customer, '')!=''"}, - {"doctype":"Address", "query": "select count(*) from `tabAddress` where ifnull(customer, '')!=''"}, - { "title": _("Selling Settings"), - "route": "Form/Selling Settings", "type": "Link", "icon": "icon-cog" }, - ] - }, - { - "doctype": "Supplier", - "dependencies": [ - {"doctype":"Supplier Type"}, - {"doctype":"Contact", "query": "select count(*) from `tabContact` where ifnull(supplier, '')!=''"}, - {"doctype":"Address", "query": "select count(*) from `tabAddress` where ifnull(supplier, '')!=''"}, - { "title": _("Buying Settings"), - "route": "Form/Buying Settings", "type": "Link", "icon": "icon-cog" }, - ] - }, - { - "type": "Section", - "title": _("Accounts"), - "icon": "icon-money" - }, - { - "doctype": "Account", - "tree": "Accounts Browser", - "dependencies": [ - { - "title": _("Bank Accounts"), - "doctype":"Account", - "filter": {"account_type": "Bank or Cash"} - }, - { - "title": _("Tax Accounts"), - "doctype":"Account", - "filter": {"account_type": "Tax"} - }, - ] - }, - { - "doctype": "Cost Center", - "tree": "Accounts Browser", - }, - { "doctype": "Sales Taxes and Charges Master" }, - { "doctype": "Purchase Taxes and Charges Master" }, - { "doctype": "Shipping Rule" }, - { "doctype": "Currency Exchange" }, - { "title": _("Accounts Settings"), - "route": "Form/Accounts Settings", "type": "Link", "icon": "icon-cog" }, - { - "type": "Section", - "title": _("Opening Accounts and Stock"), - "icon": "icon-eye-open" - }, - { "doctype": "Stock Reconciliation" }, - { - "doctype": "Journal Voucher", - "title": _("Opening Accounting Entries"), - "filter": { - "is_opening": "Yes" - } - }, - { - "type": "Section", - "title": _("Human Resource"), - "icon": "icon-group" - }, - { - "doctype": "Employee", - "dependencies": [ - { "doctype": "Employment Type" }, - { "doctype": "Branch" }, - { "doctype": "Department" }, - { "doctype": "Designation" }, - { "doctype": "Holiday List" }, - { "doctype": "Grade" }, - ] - }, - { "doctype": "Salary Structure" }, - { "doctype": "Leave Allocation" }, - { "doctype": "Appraisal Template" }, - { - "type": "Section", - "title": _("Printing"), - "icon": "icon-print" - }, - { "doctype": "Terms and Conditions" }, - { "doctype": "Letter Head" }, - { "doctype": "Print Heading" }, - { "doctype": "Print Format", "filter": {"standard": "No"} }, - { - "type": "Section", - "title": _("Email"), - "icon": "icon-envelope-alt" - }, - { - "title": _("Outgoing Email Settings"), - "doctype": "Email Settings", - "single": 1, - "query": "select count(*) from tabSingles where doctype='Email Settings' and field='outgoing_mail_server'" - }, - { - "title": _("Support Email Settings"), - "doctype": "Email Settings", - "single": 1, - "query": "select count(*) from tabSingles where doctype='Email Settings' and field='support_host'" - }, - { - "doctype": "Sales Email Settings", - "single": 1, - "query": "select count(*) from tabSingles where doctype='Sales Email Settings' and field='host'" - }, - { - "doctype": "Jobs Email Settings", - "single": 1, - "query": "select count(*) from tabSingles where doctype='Jobs Email Settings' and field='host'" - }, - { - "doctype": "Email Digest", - }, - { - "type": "Section", - "title": _("Customization"), - "icon": "icon-glass" - }, - { - "doctype": "Customize Form", - "single": 1, - "query": "select count(distinct doc_type) from `tabProperty Setter`" - }, - { "doctype": "Workflow" }, - { "doctype": "Authorization Rule" }, - { "doctype": "Custom Field" }, - { "doctype": "Custom Script" }, - { - "type": "Section", - "title": _("Tools"), - "icon": "icon-wrench" - }, - { "title": _("Global Settings / Default Values"), - "doctype": "Global Defaults", "single": 1, - "query": """select count(*) from tabSingles where doctype='Global Defaults' - and field not in ('owner', 'creation', 'modified', 'modified_by')"""}, - - { "title": _("Show / Hide Features"), - "doctype": "Features Setup", "single": 1, - "query": """select count(*) from tabSingles where doctype='Features Setup' - and field not in ('owner', 'creation', 'modified', 'modified_by')"""}, - - { "title": _("Enable / Disable Email Notifications"), - "doctype": "Notification Control", "single": 1, - "query": """select count(*) from tabSingles where doctype='Notification Control' - and field in ('quotation', 'sales_order', 'sales_invoice', 'purchase_order', 'purchase_receipt', 'expense_claim', 'delivery_note')"""}, - - { "doctype": "File Data", "title": _("Uploaded File Attachments") }, - { - "doctype": "SMS Settings", - "single": 1, - "query": "select count(*) from tabSingles where doctype='SMS Settings' and field='sms_gateway_url'" - }, - - { "title": _("Data Import"), - "route": "data-import-tool", "type": "Link", "icon": "icon-upload" }, - { "title": _("Bulk Rename"), - "route": "Form/Rename Tool", "type": "Link", "icon": "icon-upload" }, - { "title": _("Update Numbering Series"), - "route": "Form/Naming Series", "type": "Link", "icon": "icon-sort-by-order" }, - { "title": _("Show / Hide Modules"), - "route": "modules_setup", "type": "Link", "icon": "icon-th" }, - { "title": _("Send Bulk SMS to Leads / Contacts"), - "route": "Form/SMS Center", "type": "Link", "icon": "icon-mobile-phone" }, - { - "type": "Section", - "title": _("System Administration"), - "icon": "icon-cog" - }, - { "title": _("Manage 3rd Party Backups"), - "route": "Form/Backup Manager", "type": "Link", "icon": "icon-cloud" }, - { "title": _("System Scheduler Errors"), - "route": "Report/Scheduler Log", "type": "Link", "icon": "icon-exclamation-sign" }, -] - - - - -# @webnotes.whitelist() -# def get(): -# webnotes.only_for("System Manager") -# for item in items: -# if item.get("type")=="Section": -# continue -# set_count(item) -# -# if item.get("dependencies"): -# for d in item["dependencies"]: -# set_count(d) -# -# return items -# -# def set_count(item): -# if "query" in item: -# item["count"] = webnotes.conn.sql(item["query"])[0][0] -# elif "filter" in item: -# key = item["filter"].keys()[0] -# item["count"] = webnotes.conn.sql("""select count(*) from `tab%s` where -# %s = %s and docstatus < 2""" % (item["doctype"], key, "%s"), -# item["filter"][key])[0][0] -# elif "doctype" in item: -# item["count"] = webnotes.conn.sql("select count(*) from `tab%s` where docstatus<2" \ -# % item["doctype"])[0][0] diff --git a/erpnext/setup/page/setup/setup.txt b/erpnext/setup/page/setup/setup.txt deleted file mode 100644 index 723a9018f6..0000000000 --- a/erpnext/setup/page/setup/setup.txt +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "creation": "2012-06-14 15:07:28", - "docstatus": 0, - "modified": "2013-07-11 14:44:04", - "modified_by": "Administrator", - "owner": "Administrator" - }, - { - "doctype": "Page", - "icon": "icon-cog", - "module": "Setup", - "name": "__common__", - "page_name": "Setup", - "standard": "Yes" - }, - { - "doctype": "Page Role", - "name": "__common__", - "parent": "Setup", - "parentfield": "roles", - "parenttype": "Page", - "role": "System Manager" - }, - { - "doctype": "Page", - "name": "Setup" - }, - { - "doctype": "Page Role" - } -] \ No newline at end of file diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 4450af7594..aec9477ebb 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -75,8 +75,10 @@ class DocType(BuyingController): pc_obj = get_obj(dt='Purchase Common') pc_obj.validate_for_items(self) - - self.validate_qty_against_so() + + # self.validate_qty_against_so() + # NOTE: Since Item BOM and FG quantities are combined, using current data, it cannot be validated + # Though the creation of Material Request from a Production Plan can be rethought to fix this def update_bin(self, is_submit, is_stopped): """ Update Quantity Requested for Purchase in Bin for Material Request of type 'Purchase'"""