From d50da78f288d955144cc49a4b3a840fca002b13c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 28 Jul 2017 11:39:01 +0530 Subject: [PATCH] [fixes] errors caught on flake8 (#10126) --- erpnext/accounts/utils.py | 55 +++--- .../test_production_planning_tool.py | 161 +++++++++--------- .../patches/v4_2/add_currency_turkish_lira.py | 4 +- erpnext/patches/v4_2/default_website_style.py | 12 +- erpnext/patches/v7_0/update_party_status.py | 32 ++-- .../patches/v8_1/delete_deprecated_reports.py | 2 +- 6 files changed, 127 insertions(+), 139 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 73fdf6f6f9..cce1e6fff9 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -20,36 +20,36 @@ def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1, compan def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verbose=1, company=None, as_dict=False): fiscal_years = frappe.cache().hget("fiscal_years", company) or [] - - if not fiscal_years: + + if not fiscal_years: # if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate) cond = "" if fiscal_year: cond += " and fy.name = {0}".format(frappe.db.escape(fiscal_year)) if company: cond += """ - and (not exists (select name - from `tabFiscal Year Company` fyc - where fyc.parent = fy.name) - or exists(select company - from `tabFiscal Year Company` fyc - where fyc.parent = fy.name + and (not exists (select name + from `tabFiscal Year Company` fyc + where fyc.parent = fy.name) + or exists(select company + from `tabFiscal Year Company` fyc + where fyc.parent = fy.name and fyc.company=%(company)s) ) """ fiscal_years = frappe.db.sql(""" - select - fy.name, fy.year_start_date, fy.year_end_date - from + select + fy.name, fy.year_start_date, fy.year_end_date + from `tabFiscal Year` fy - where + where disabled = 0 {0} - order by + order by fy.year_start_date desc""".format(cond), { "company": company }, as_dict=True) - + frappe.cache().hset("fiscal_years", company, fiscal_years) if transaction_date: @@ -60,10 +60,10 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb if fiscal_year and fy.name == fiscal_year: matched = True - if (transaction_date and getdate(fy.year_start_date) <= transaction_date + if (transaction_date and getdate(fy.year_start_date) <= transaction_date and getdate(fy.year_end_date) >= transaction_date): matched = True - + if matched: if as_dict: return (fy,) @@ -158,7 +158,6 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company return flt(bal) def get_count_on(account, fieldname, date): - cond = [] if date: cond.append("posting_date <= '%s'" % frappe.db.escape(cstr(date))) @@ -195,11 +194,6 @@ def get_count_on(account, fieldname, date): select name from `tabAccount` ac where ac.name = gle.account and ac.lft >= %s and ac.rgt <= %s )""" % (acc.lft, acc.rgt)) - - # If group and currency same as company, - # always return balance based on debit and credit in company currency - if acc.account_currency == frappe.db.get_value("Company", acc.company, "default_currency"): - in_account_currency = False else: cond.append("""gle.account = "%s" """ % (frappe.db.escape(account, percent=False), )) @@ -227,7 +221,7 @@ def get_count_on(account, fieldname, date): WHERE docstatus < 2 and posting_date <= %(date)s and against_voucher = %(voucher_no)s and party = %(party)s and name != %(name)s""" .format(select_fields), - {"date": date, "voucher_no": gle.voucher_no, + {"date": date, "voucher_no": gle.voucher_no, "party": gle.party, "name": gle.name})[0][0] outstanding_amount = flt(gle.get(dr_or_cr)) - flt(gle.get(cr_or_dr)) - payment_amount @@ -274,7 +268,7 @@ def add_cc(args=None): if not args: args = frappe.local.form_dict - + args.doctype = "Cost Center" args = make_tree_args(**args) @@ -534,18 +528,18 @@ def get_stock_and_account_difference(account_list=None, posting_date=None): account_balance = get_balance_on(account_data.get('account'), posting_date, in_account_currency=False) stock_value = get_stock_value_on(warehouse, posting_date) if abs(flt(stock_value) - flt(account_balance)) > 0.005: - difference.setdefault(account, flt(stock_value) - flt(account_balance)) + difference.setdefault(account_data.get('account'), flt(stock_value) - flt(account_balance)) return difference -def get_currency_precision(): +def get_currency_precision(): precision = cint(frappe.db.get_default("currency_precision")) if not precision: number_format = frappe.db.get_default("number_format") or "#,###.##" precision = get_number_format_info(number_format)[2] - + return precision - + def get_stock_rbnb_difference(posting_date, company): stock_items = frappe.db.sql_list("""select distinct item_code from `tabStock Ledger Entry` where company=%s""", company) @@ -654,7 +648,7 @@ def get_companies(): @frappe.whitelist() def get_children(): from erpnext.accounts.report.financial_statements import sort_root_accounts - + args = frappe.local.form_dict doctype, company = args['doctype'], args['company'] fieldname = frappe.db.escape(doctype.lower().replace(' ','_')) @@ -695,9 +689,6 @@ def get_children(): return acc -def create_payment_gateway_account(gateway): - create_payment_gateway_account(gateway) - def create_payment_gateway_account(gateway): from erpnext.setup.setup_wizard.setup_wizard import create_bank_account diff --git a/erpnext/manufacturing/doctype/production_planning_tool/test_production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/test_production_planning_tool.py index 4f80b6a626..af4220ccfc 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/test_production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/test_production_planning_tool.py @@ -15,7 +15,7 @@ test_records = frappe.get_test_records('Production Planning Tool') test_dependencies = ["Item","BOM"] class TestEvent(unittest.TestCase): - + def test_materials_requests_all_raw_multi_level(self): items = ["_Test PPT Item Raw A","_Test PPT Item Raw B","_Test PPT Item Raw C","_Test PPT Item Raw D", "_Test PPT Item Sub A","_Test PPT Item Sub B","_Test PPT Item Sub C","_Test PPT Item SC A", @@ -23,10 +23,10 @@ class TestEvent(unittest.TestCase): quantities = [14,9,36,1,0,0,0,0,0,0] types = ["Purchase","Purchase","Purchase","Purchase","Manufacture","Manufacture","Manufacture","Purchase", "Purchase","Manufacture"] - + self.runtest_materials_requests(items, quantities, types, use_multi_level_bom=1, only_raw_materials=1, \ include_subcontracted=1) - + def test_materials_requests_multi_no_subcontracted(self): items = ["_Test PPT Item Raw A","_Test PPT Item Raw B","_Test PPT Item Raw C","_Test PPT Item Raw D", "_Test PPT Item Sub A","_Test PPT Item Sub B","_Test PPT Item Sub C","_Test PPT Item SC A", @@ -34,12 +34,12 @@ class TestEvent(unittest.TestCase): quantities = [14,5,20,0,0,0,0,0,0,0] types = ["Purchase","Purchase","Purchase","Purchase","Manufacture","Manufacture","Manufacture","Purchase", "Purchase","Manufacture"] - + # This one should fail for now self.runtest_materials_requests(items, quantities, types, use_multi_level_bom=1, only_raw_materials=1, \ include_subcontracted=0) - + def test_materials_requests_manufacture_and_sub_multi_level(self): items = ["_Test PPT Item Raw A","_Test PPT Item Raw B","_Test PPT Item Raw C","_Test PPT Item Raw D", @@ -48,10 +48,10 @@ class TestEvent(unittest.TestCase): quantities = [14,9,36,1,2,5,2,1,4,0] types = ["Purchase","Purchase","Purchase","Purchase","Manufacture","Manufacture","Manufacture","Purchase", "Purchase","Manufacture"] - + self.runtest_materials_requests(items, quantities, types, use_multi_level_bom=1, only_raw_materials=0, \ include_subcontracted=1) - + def test_materials_requests_manufacture_multi_level(self): items = ["_Test PPT Item Raw A","_Test PPT Item Raw B","_Test PPT Item Raw C","_Test PPT Item Raw D", "_Test PPT Item Sub A","_Test PPT Item Sub B","_Test PPT Item Sub C","_Test PPT Item SC A", @@ -59,12 +59,12 @@ class TestEvent(unittest.TestCase): quantities = [14,5,20,0,2,5,2,1,4,0] types = ["Purchase","Purchase","Purchase","Purchase","Manufacture","Manufacture","Manufacture","Purchase", "Purchase","Manufacture"] - + self.runtest_materials_requests(items, quantities, types, use_multi_level_bom=1, only_raw_materials=0, \ include_subcontracted=0) - - - + + + def test_materials_requests_single_level_purch_only(self): items = ["_Test PPT Item Raw A","_Test PPT Item Raw B","_Test PPT Item Raw C","_Test PPT Item Raw D", "_Test PPT Item Sub A","_Test PPT Item Sub B","_Test PPT Item Sub C","_Test PPT Item SC A", @@ -72,10 +72,10 @@ class TestEvent(unittest.TestCase): quantities = [2,0,0,0,0,0,0,1,0,0] types = ["Purchase","Purchase","Purchase","Purchase","Manufacture","Manufacture","Manufacture","Purchase", "Purchase","Manufacture"] - + self.runtest_materials_requests(items, quantities, types, use_multi_level_bom=0, only_raw_materials=1, \ include_subcontracted=0) - + def test_materials_requests_single_level(self): items = ["_Test PPT Item Raw A","_Test PPT Item Raw B","_Test PPT Item Raw C","_Test PPT Item Raw D", "_Test PPT Item Sub A","_Test PPT Item Sub B","_Test PPT Item Sub C","_Test PPT Item SC A", @@ -83,32 +83,32 @@ class TestEvent(unittest.TestCase): quantities = [2,0,0,0,2,1,0,1,0,0] types = ["Purchase","Purchase","Purchase","Purchase","Manufacture","Manufacture","Manufacture","Purchase", "Purchase","Manufacture"] - + self.runtest_materials_requests(items, quantities, types, use_multi_level_bom=0, only_raw_materials=0, \ include_subcontracted=0) - + def runtest_materials_requests(self, items, quantities, types,use_multi_level_bom, only_raw_materials, \ include_subcontracted): - + clear_material_requests() create_test_records() - - ppt = run_production_planning_tool(use_multi_level_bom=use_multi_level_bom, - only_raw_materials=only_raw_materials, include_subcontracted=include_subcontracted, - item_code = "_Test PPT Item Master", bom_no = "BOM-_Test PPT Item Master-001", - planned_qty = 1, planned_start_date = "5/5/2029", + + ppt = run_production_planning_tool(use_multi_level_bom=use_multi_level_bom, + only_raw_materials=only_raw_materials, include_subcontracted=include_subcontracted, + item_code = "_Test PPT Item Master", bom_no = "BOM-_Test PPT Item Master-001", + planned_qty = 1, planned_start_date = "5/5/2029", warehouse = "_Test Warehouse - _TC", company = "_Test Company") - + create_material_requests(ppt) - + for item, qty, type in zip(items, quantities, types): self.assertEqual(qty, get_requested_qty(item)) for mat_req_type in get_requested_types(item): - self.assertEqual(type, mat_req_type) - + self.assertEqual(type, mat_req_type) + def create_test_records(): from erpnext.stock.doctype.item.test_item import make_item - + subA = make_item("_Test PPT Item Sub A",{ "item_code": "_Test PPT Item Sub A", "item_name": "_Test PPT Item Sub A", @@ -119,7 +119,7 @@ def create_test_records(): "stock_uom": "_Test UOM", "item_group": "_Test Item Group", "default_warehouse": "_Test Warehouse - _TC"}) - + subB = make_item("_Test PPT Item Sub B",{ "item_code": "_Test PPT Item Sub B", "item_name": "_Test PPT Item Sub B", @@ -130,7 +130,7 @@ def create_test_records(): "stock_uom": "_Test UOM", "item_group": "_Test Item Group", "default_warehouse": "_Test Warehouse - _TC"}) - + subC = make_item("_Test PPT Item Sub C",{ "item_code": "_Test PPT Item Sub C", "item_name": "_Test PPT Item Sub C", @@ -141,7 +141,7 @@ def create_test_records(): "stock_uom": "_Test UOM", "item_group": "_Test Item Group", "default_warehouse": "_Test Warehouse - _TC"}) - + sCA = make_item("_Test PPT Item SC A",{ "item_code": "_Test PPT Item SC A", "item_name": "_Test PPT Item SC A", @@ -172,7 +172,7 @@ def create_test_records(): "stock_uom": "_Test UOM", "item_group": "_Test Item Group", "default_warehouse": "_Test Warehouse - _TC"}) - + rawA = make_item("_Test PPT Item Raw A",{ "item_code": "_Test PPT Item Raw A", "item_name": "_Test PPT Item Raw A", @@ -183,7 +183,7 @@ def create_test_records(): "stock_uom": "_Test UOM", "item_group": "_Test Item Group", "default_warehouse": "_Test Warehouse - _TC"}) - + rawB = make_item("_Test PPT Item Raw B",{ "item_code": "_Test PPT Item Raw B", "item_name": "_Test PPT Item Raw B", @@ -194,7 +194,7 @@ def create_test_records(): "stock_uom": "_Test UOM", "item_group": "_Test Item Group", "default_warehouse": "_Test Warehouse - _TC"}) - + rawC = make_item("_Test PPT Item Raw C",{ "item_code": "_Test PPT Item Raw C", "item_name": "_Test PPT Item Raw C", @@ -205,7 +205,7 @@ def create_test_records(): "stock_uom": "_Test UOM", "item_group": "_Test Item Group", "default_warehouse": "_Test Warehouse - _TC"}) - + rawD = make_item("_Test PPT Item Raw D",{ "item_code": "_Test PPT Item Raw D", "item_name": "_Test PPT Item Raw D", @@ -216,7 +216,7 @@ def create_test_records(): "stock_uom": "_Test UOM", "item_group": "_Test Item Group", "default_warehouse": "_Test Warehouse - _TC"}) - + master = make_item("_Test PPT Item Master",{ "item_code": "_Test PPT Item Master", "item_name": "_Test PPT Item Master", @@ -227,9 +227,9 @@ def create_test_records(): "stock_uom": "_Test UOM", "item_group": "_Test Item Group", "default_warehouse": "_Test Warehouse - _TC"}) - - - + + + bom_subB = make_bom("BOM-_Test PPT Item Sub B-001",{"quantity":1.0, "item": "_Test PPT Item Sub B", "is_active": 1, @@ -239,39 +239,39 @@ def create_test_records(): "rate":100, "amount": 100, "stock_uom": "_Test UOM"}, {"item_code": "_Test PPT Item Raw C", "doctype":"BOM Item", "stock_qty":4, "rate":100, "amount": 400,"stock_uom": "_Test UOM"}]) - + bom_subC = make_bom("BOM-_Test PPT Item Sub C-001",{"quantity":1, "item": "_Test PPT Item Sub C", "is_active": 1, "is_default": 1, "docstatus": 1, "with_operations": 0}, [ - {"item_code": "_Test PPT Item Raw A","item_name": "_Test PPT Item Raw A", + {"item_code": "_Test PPT Item Raw A","item_name": "_Test PPT Item Raw A", "doctype":"BOM Item", "stock_qty":6, "rate":100, "amount": 600}, - {"item_code": "_Test PPT Item Sub B","item_name": "_Test PPT Item Sub B", + {"item_code": "_Test PPT Item Sub B","item_name": "_Test PPT Item Sub B", "bom_no":"BOM-_Test PPT Item Sub B-001", "doctype":"BOM Item", "stock_qty":2, "rate":100, "amount": 200}]) - + bom_sCA = make_bom("BOM-_Test PPT Item SC A-001",{"quantity":1, "item": "_Test PPT Item SC A", "is_active": 1, "is_default": 1, "docstatus": 1, "with_operations": 0}, [ - {"item_code": "_Test PPT Item Raw D","item_name": "_Test PPT Item Raw D", + {"item_code": "_Test PPT Item Raw D","item_name": "_Test PPT Item Raw D", "doctype":"BOM Item", "stock_qty":1, "rate":100, "amount": 100}]) - + bom_sCB = make_bom("BOM-_Test PPT Item SC B-001",{"quantity":1, "item": "_Test PPT Item SC B", "is_active": 1, "is_default": 1, "docstatus": 1, "with_operations": 0}, [ - {"item_code": "_Test PPT Item Raw B","item_name": "_Test PPT Item Raw B", + {"item_code": "_Test PPT Item Raw B","item_name": "_Test PPT Item Raw B", "doctype":"BOM Item", "stock_qty":1, "rate":100, "amount": 100}, - {"item_code": "_Test PPT Item Raw C","item_name": "_Test PPT Item Raw C", + {"item_code": "_Test PPT Item Raw C","item_name": "_Test PPT Item Raw C", "doctype":"BOM Item", "stock_qty":4, "rate":100, "amount": 400}]) - + bom_subA = make_bom("BOM-_Test PPT Item Sub A-001",{"quantity":1, "item": "_Test PPT Item Sub A", "is_active": 1, @@ -279,29 +279,29 @@ def create_test_records(): "docstatus": 1, "with_operations": 0}, [ {"item_code": "_Test PPT Item Sub C","item_name": "_Test PPT Item Sub C", - "bom_no":"BOM-_Test PPT Item Sub C-001", "doctype":"BOM Item", + "bom_no":"BOM-_Test PPT Item Sub C-001", "doctype":"BOM Item", "stock_qty":1, "rate":100, "amount": 100}, - {"item_code": "_Test PPT Item SC B","item_name": "_Test PPT Item SC B", + {"item_code": "_Test PPT Item SC B","item_name": "_Test PPT Item SC B", "bom_no":"BOM-_Test PPT Item SC B-001", "doctype":"BOM Item", "stock_qty":2, - "rate":100, "amount": 200}]) - + "rate":100, "amount": 200}]) + bom_master = make_bom("BOM-_Test PPT Item Master-001",{"quantity":1, "item": "_Test PPT Item Master", "is_active": 1, "is_default": 1, "docstatus": 1, "with_operations": 0}, [ - {"item_code": "_Test PPT Item Sub A","item_name": "_Test PPT Item Sub A", - "bom_no":"BOM-_Test PPT Item Sub A-001", + {"item_code": "_Test PPT Item Sub A","item_name": "_Test PPT Item Sub A", + "bom_no":"BOM-_Test PPT Item Sub A-001", "doctype":"BOM Item", "stock_qty":2, "rate":100, "amount": 200}, - {"item_code": "_Test PPT Item Sub B","item_name": "_Test PPT Item Sub B", - "bom_no":"BOM-_Test PPT Item Sub B-001", + {"item_code": "_Test PPT Item Sub B","item_name": "_Test PPT Item Sub B", + "bom_no":"BOM-_Test PPT Item Sub B-001", "doctype":"BOM Item", "stock_qty":1, "rate":100, "amount": 100}, - {"item_code": "_Test PPT Item Raw A","item_name": "_Test PPT Item Raw A", + {"item_code": "_Test PPT Item Raw A","item_name": "_Test PPT Item Raw A", "doctype":"BOM Item", "stock_qty":2, "rate":100, "amount": 200}, - {"item_code": "_Test PPT Item SC A","item_name": "_Test PPT Item SC A", - "bom_no":"BOM-_Test PPT Item SC A-001", + {"item_code": "_Test PPT Item SC A","item_name": "_Test PPT Item SC A", + "bom_no":"BOM-_Test PPT Item SC A-001", "doctype":"BOM Item", "stock_qty":1, "rate":100, "amount": 100} ]) @@ -309,7 +309,7 @@ def create_test_records(): def make_bom(name, properties=None, items=None): if frappe.db.exists("BOM", name): return frappe.get_doc("BOM", name) - + bom = frappe.new_doc("BOM") item = frappe.get_doc({ "doctype": "BOM", @@ -317,20 +317,20 @@ def make_bom(name, properties=None, items=None): "quantity": "1", "with_operations": 0 }) - + if properties: bom.update(properties) - + if items: for item in items: bom.append("items", item) - + bom.insert() bom.submit() - + return bom - + def clear_material_requests(): frappe.db.sql("delete from `tabMaterial Request Item`") frappe.db.sql("delete from `tabMaterial Request`") @@ -339,53 +339,50 @@ def clear_material_requests(): def run_production_planning_tool(**args): ppt = frappe.new_doc("Production Planning Tool") args = frappe._dict(args) - + if args.use_multi_level_bom: ppt.use_multi_level_bom = args.use_multi_level_bom else: ppt.use_multi_level_bom = 0 - + if args.only_raw_materials: ppt.only_raw_materials = args.only_raw_materials else: ppt.only_raw_materials = 0 - + if args.include_subcontracted: ppt.include_subcontracted = args.include_subcontracted else: ppt.include_subcontracted = 0 - + if args.warehouse: - ppt.purchase_request_for_warehouse = args.warehouse - + ppt.purchase_request_for_warehouse = args.warehouse + if args.company: ppt.company = args.company ppt.create_material_requests_for_all_required_qty = 1 - - ppt.append("items",{"item_code": args.item_code, "bom_no": args.bom_no, "planned_qty": args.planned_qty, - "planned_start_date": args.planned_start_date, "warehouse": args.warehouse}) - - return ppt -def create_production_orders(ppt): - raise_production_orders(ppt) + ppt.append("items",{"item_code": args.item_code, "bom_no": args.bom_no, "planned_qty": args.planned_qty, + "planned_start_date": args.planned_start_date, "warehouse": args.warehouse}) + + return ppt def create_material_requests(ppt): ppt.raise_material_requests() - + def get_requested_qty(item_code): total_qty = 0 - for d in frappe.db.sql("""select item.qty as qty - from `tabMaterial Request` mat_req, `tabMaterial Request Item` item + for d in frappe.db.sql("""select item.qty as qty + from `tabMaterial Request` mat_req, `tabMaterial Request Item` item where item.item_code = %(item_code)s and item.parent = mat_req.name""", {"item_code":item_code}, as_dict=1): total_qty += d.qty return total_qty def get_requested_types(item_code): types = [] - for d in frappe.db.sql("""select mat_req.material_request_type as type - from `tabMaterial Request` mat_req, `tabMaterial Request Item` item + for d in frappe.db.sql("""select mat_req.material_request_type as type + from `tabMaterial Request` mat_req, `tabMaterial Request Item` item where item.item_code = %(item_code)s and item.parent = mat_req.name""", {"item_code":item_code}, as_dict=1): types.append(d.type) return types - + diff --git a/erpnext/patches/v4_2/add_currency_turkish_lira.py b/erpnext/patches/v4_2/add_currency_turkish_lira.py index dac1fe908f..1a46089f94 100644 --- a/erpnext/patches/v4_2/add_currency_turkish_lira.py +++ b/erpnext/patches/v4_2/add_currency_turkish_lira.py @@ -6,5 +6,5 @@ import frappe def execute(): return - country = get_country_info(country="Turkey") - add_country_and_currency("Turkey", country) + # country = get_country_info(country="Turkey") + # add_country_and_currency("Turkey", country) diff --git a/erpnext/patches/v4_2/default_website_style.py b/erpnext/patches/v4_2/default_website_style.py index d168c86831..e8f9502ea6 100644 --- a/erpnext/patches/v4_2/default_website_style.py +++ b/erpnext/patches/v4_2/default_website_style.py @@ -3,9 +3,9 @@ import frappe def execute(): return - frappe.reload_doc('website', 'doctype', 'style_settings') - style_settings = frappe.get_doc("Style Settings", "Style Settings") - if not style_settings.apply_style: - style_settings.update(default_properties) - style_settings.apply_style = 1 - style_settings.save() + # frappe.reload_doc('website', 'doctype', 'style_settings') + # style_settings = frappe.get_doc("Style Settings", "Style Settings") + # if not style_settings.apply_style: + # style_settings.update(default_properties) + # style_settings.apply_style = 1 + # style_settings.save() diff --git a/erpnext/patches/v7_0/update_party_status.py b/erpnext/patches/v7_0/update_party_status.py index f3733dbd84..9ca3d02b9d 100644 --- a/erpnext/patches/v7_0/update_party_status.py +++ b/erpnext/patches/v7_0/update_party_status.py @@ -2,19 +2,19 @@ import frappe def execute(): return - for party_type in ('Customer', 'Supplier'): - frappe.reload_doctype(party_type) - - # set all as default status - frappe.db.sql('update `tab{0}` set status=%s'.format(party_type), default_status[party_type]) - - for doctype in status_depends_on[party_type]: - filters = get_filters_for(doctype) - parties = frappe.get_all(doctype, fields="{0} as party".format(party_type.lower()), - filters=filters, limit_page_length=1) - - parties = filter(None, [p.party for p in parties]) - - if parties: - frappe.db.sql('update `tab{0}` set status="Open" where name in ({1})'.format(party_type, - ', '.join(len(parties) * ['%s'])), parties) \ No newline at end of file + # for party_type in ('Customer', 'Supplier'): + # frappe.reload_doctype(party_type) + # + # # set all as default status + # frappe.db.sql('update `tab{0}` set status=%s'.format(party_type), default_status[party_type]) + # + # for doctype in status_depends_on[party_type]: + # filters = get_filters_for(doctype) + # parties = frappe.get_all(doctype, fields="{0} as party".format(party_type.lower()), + # filters=filters, limit_page_length=1) + # + # parties = filter(None, [p.party for p in parties]) + # + # if parties: + # frappe.db.sql('update `tab{0}` set status="Open" where name in ({1})'.format(party_type, + # ', '.join(len(parties) * ['%s'])), parties) \ No newline at end of file diff --git a/erpnext/patches/v8_1/delete_deprecated_reports.py b/erpnext/patches/v8_1/delete_deprecated_reports.py index 887277ab9c..99d77c103c 100644 --- a/erpnext/patches/v8_1/delete_deprecated_reports.py +++ b/erpnext/patches/v8_1/delete_deprecated_reports.py @@ -51,4 +51,4 @@ def check_and_update_auto_email_report(report): frappe.delete_doc("Auto Email Report", auto_email_report) elif report in ["Customer Addresses And Contacts", "Supplier Addresses And Contacts"]: - frapppe.db.set_value("Auto Email Report", auto_email_report, "report", report) \ No newline at end of file + frappe.db.set_value("Auto Email Report", auto_email_report, "report", report) \ No newline at end of file