{"action":"created","issue":{"url":"https://api.github.com/repos/frappe/erpnext/issues/3450","labels_url":"https://api.github.com/repos/frappe/erpnext/issues/3450/labels{/name}","comments_url":"https://api.github.com/repos/frappe/erpnext/issues/3450/comments","events_url":"https://api.github.com/repos/frappe/erpnext/issues/3450/events","html_url":"https://github.com/frappe/erpnext/issues/3450","id":86981506,"number":3450,"title":"i have need to how to set if-else condition to show different table record","user":{"login":"pankajpatel12","id":12660363,"avatar_url":"https://avatars.githubusercontent.com/u/12660363?v=3","gravatar_id":"","url":"https://api.github.com/users/pankajpatel12","html_url":"https://github.com/pankajpatel12","followers_url":"https://api.github.com/users/pankajpatel12/followers","following_url":"https://api.github.com/users/pankajpatel12/following{/other_user}","gists_url":"https://api.github.com/users/pankajpatel12/gists{/gist_id}","starred_url":"https://api.github.com/users/pankajpatel12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pankajpatel12/subscriptions","organizations_url":"https://api.github.com/users/pankajpatel12/orgs","repos_url":"https://api.github.com/users/pankajpatel12/repos","events_url":"https://api.github.com/users/pankajpatel12/events{/privacy}","received_events_url":"https://api.github.com/users/pankajpatel12/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-10T14:02:09Z","updated_at":"2015-06-12T11:11:33Z","closed_at":"2015-06-10T14:49:30Z","body":"below is my .py code and after \"error\"  i have need to how to set if-else condition to show different table record and how to remove this error and get preffect output..\r\n\r\n# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\r\n# License: GNU General Public License v3. See license.txt\r\n\r\nfrom __future__ import unicode_literals\r\nimport frappe\r\nfrom frappe import _, msgprint\r\n\r\ndef execute(filters=None):\r\n\tif not filters: filters = {}\r\n\t\r\n\tcolumns = get_columns()\r\n\tdata = get_entries(filters)\r\n\t\r\n\treturn columns, data\r\n\t\r\ndef get_columns():\r\n\treturn [_(\"Name\") + \":Link/Vegetable Production\", _(\"Division Name\") + \":Link/Division\", _(\"Field Name\") + \":Link/Field\", \r\n\t\t_(\"Variety\") + \":Link/Vegetable Production\", _(\"Plant Row Width\") + \":Link/Vegetable Production\", _(\"Plant Spacing\") + \":Link/Vegetable Production\", _(\"Type\") + \":Link/Vegetable Production\", _(\"Type of Soil\") + \":\", _(\"Size\") + \":\", _(\"Color\") + \":\", _(\"Unit of Measure\") + \":\"]\r\n\r\ndef get_conditions(filters):\r\n\tconditions = \"\"\r\n\tif not filters.get(\"name1\"):\r\n\t\tmsgprint(_(\"Please select Vegetable Production Name\"), raise_exception=1)\r\n\t\t\r\n\telse:\r\n\t\tconditions += \" and name1 = %(name1)s\"\r\n\t\r\n\t\tif  get_entries(\"division_name\") !=\"\":\r\n\t\r\n\t\tentries =  frappe.db.sql(\"\"\"select name1, field_name, variety, \r\n\t\t\tplant_row_width, plant_spacing, type, type_of_soil, size, color, unit_of_measure\r\n\t\t\tFROM `tabVegetable Production`, `tabField`\r\n\t \t\tWHERE `tabVegetable Production`.`field_name` = `tabField`.`field` %s\"\"\"% conditions, filters)\r\n\t\telse:\r\n\t\r\n\t\tentries =  frappe.db.sql(\"\"\"select name1, division_name, variety,\r\n\t\t\tplant_row_width, plant_spacing, type, type_of_soil, size, color, unit_of_measure\r\n\t\t\tFROM `tabVegetable Production`, `tabDivision`\r\n\t \t\tWHERE `tabVegetable Production`.`division_name` = `tabDivision`.`division` %s\"\"\"% conditions, filters)\r\n\treturn entries\r\n\t\t\r\n\treturn conditions\r\n\t\r\n#def get_entries(filters):\r\n#\tconditions = get_conditions(filters)\r\n\t...............................................................................................................................................................\r\n\t......\"Error\".......\r\nTraceback (innermost last):\r\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/app.py\", line 51, in application\r\n    response = frappe.handler.handle()\r\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py\", line 70, in handle\r\n    execute_cmd(cmd)\r\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py\", line 93, in execute_cmd\r\n    ret = frappe.call(method, **frappe.form_dict)\r\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py\", line 751, in call\r\n    return fn(*args, **newargs)\r\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/desk/query_report.py\", line 87, in run\r\n    columns, result = frappe.get_attr(method_name)(frappe._dict(filters))\r\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py\", line 734, in get_attr\r\n    return getattr(get_module(modulename), methodname)\r\n  File \"/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py\", line 564, in get_module\r\n    return importlib.import_module(modulename)\r\n  File \"/usr/lib/python2.7/importlib/__init__.py\", line 37, in import_module\r\n    __import__(name)\r\n  File \"/home/erpnext/frappe-bench/apps/agri_farm/agri_farm/agri_farm/report/vegetable_production_details/vegetable_production_details.py\", line 30\r\n    entries =  frappe.db.sql(\"\"\"select name1, field_name, variety,\r\n          ^\r\n IndentationError: expected an indented block"},"comment":{"url":"https://api.github.com/repos/frappe/erpnext/issues/comments/111454934","html_url":"https://github.com/frappe/erpnext/issues/3450#issuecomment-111454934","issue_url":"https://api.github.com/repos/frappe/erpnext/issues/3450","id":111454934,"user":{"login":"pankajpatel12","id":12660363,"avatar_url":"https://avatars.githubusercontent.com/u/12660363?v=3","gravatar_id":"","url":"https://api.github.com/users/pankajpatel12","html_url":"https://github.com/pankajpatel12","followers_url":"https://api.github.com/users/pankajpatel12/followers","following_url":"https://api.github.com/users/pankajpatel12/following{/other_user}","gists_url":"https://api.github.com/users/pankajpatel12/gists{/gist_id}","starred_url":"https://api.github.com/users/pankajpatel12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pankajpatel12/subscriptions","organizations_url":"https://api.github.com/users/pankajpatel12/orgs","repos_url":"https://api.github.com/users/pankajpatel12/repos","events_url":"https://api.github.com/users/pankajpatel12/events{/privacy}","received_events_url":"https://api.github.com/users/pankajpatel12/received_events","type":"User","site_admin":false},"created_at":"2015-06-12T11:11:33Z","updated_at":"2015-06-12T11:11:33Z","body":"thank you"}}