From eba1bdbccadd88ddb8f828ff1447c9d433a46eb0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 12 Feb 2014 16:04:17 +0530 Subject: [PATCH] minor fixes --- erpnext/controllers/selling_controller.py | 6 +++--- erpnext/patches/4_0/fields_to_be_renamed.py | 3 ++- erpnext/stock/doctype/item/item.js | 2 +- erpnext/stock/doctype/item/test_item.py | 16 ++++++++-------- erpnext/stock/get_item_details.py | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index a7fdcd074a..90ab919370 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -372,10 +372,10 @@ def check_active_sales_items(obj): for d in obj.doclist.get({"parentfield": obj.fname}): if d.item_code: item = webnotes.conn.sql("""select docstatus, is_sales_item, - is_service_item, default_income_account from tabItem where name = %s""", + is_service_item, income_account from tabItem where name = %s""", d.item_code, as_dict=True)[0] if item.is_sales_item == 'No' and item.is_service_item == 'No': webnotes.throw(_("Item is neither Sales nor Service Item") + ": " + d.item_code) - if d.income_account and not item.default_income_account: - webnotes.conn.set_value("Item", d.item_code, "default_income_account", + if d.income_account and not item.income_account: + webnotes.conn.set_value("Item", d.item_code, "income_account", d.income_account) diff --git a/erpnext/patches/4_0/fields_to_be_renamed.py b/erpnext/patches/4_0/fields_to_be_renamed.py index 6bacd1991e..e973cdd310 100644 --- a/erpnext/patches/4_0/fields_to_be_renamed.py +++ b/erpnext/patches/4_0/fields_to_be_renamed.py @@ -93,7 +93,8 @@ def execute(): "Item": [ ["purchase_account", "expense_account"], ["default_sales_cost_center", "selling_cost_center"], - ["cost_center", "buying_cost_center"] + ["cost_center", "buying_cost_center"], + ["default_income_account", "income_account"], ], "Item Price": [ ["ref_rate", "price_list_rate"] diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index bc2975844b..3a3129cb35 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -63,7 +63,7 @@ cur_frm.fields_dict['expense_account'].get_query = function(doc) { // Income Account // -------------------------------- -cur_frm.fields_dict['default_income_account'].get_query = function(doc) { +cur_frm.fields_dict['income_account'].get_query = function(doc) { return { filters: { 'debit_or_credit': "Credit", diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index 6142ac48bf..39b77df099 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -78,7 +78,7 @@ test_records = [ "is_pro_applicable": "Yes", "is_sub_contracted_item": "No", "stock_uom": "_Test UOM", - "default_income_account": "Sales - _TC", + "income_account": "Sales - _TC", "default_warehouse": "_Test Warehouse - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC", "selling_cost_center": "_Test Cost Center - _TC", @@ -108,7 +108,7 @@ test_records = [ "is_pro_applicable": "Yes", "is_sub_contracted_item": "No", "stock_uom": "_Test UOM", - "default_income_account": "Sales - _TC", + "income_account": "Sales - _TC", "default_warehouse": "_Test Warehouse - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC" }], @@ -119,7 +119,7 @@ test_records = [ "description": "_Test Item Home Desktop 100", "item_group": "_Test Item Group Desktops", "default_warehouse": "_Test Warehouse - _TC", - "default_income_account": "Sales - _TC", + "income_account": "Sales - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "Yes", "is_asset_item": "No", @@ -146,7 +146,7 @@ test_records = [ "description": "_Test Item Home Desktop 200", "item_group": "_Test Item Group Desktops", "default_warehouse": "_Test Warehouse - _TC", - "default_income_account": "Sales - _TC", + "income_account": "Sales - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "Yes", "is_asset_item": "No", @@ -167,7 +167,7 @@ test_records = [ "item_name": "_Test Sales BOM Item", "description": "_Test Sales BOM Item", "item_group": "_Test Item Group Desktops", - "default_income_account": "Sales - _TC", + "income_account": "Sales - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "No", "is_asset_item": "No", @@ -189,7 +189,7 @@ test_records = [ "item_group": "_Test Item Group Desktops", "is_stock_item": "Yes", "default_warehouse": "_Test Warehouse - _TC", - "default_income_account": "Sales - _TC", + "income_account": "Sales - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC", "is_asset_item": "No", "has_batch_no": "No", @@ -266,7 +266,7 @@ test_records = [ "description": "_Test Item Home Desktop Manufactured", "item_group": "_Test Item Group Desktops", "default_warehouse": "_Test Warehouse - _TC", - "default_income_account": "Sales - _TC", + "income_account": "Sales - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "Yes", "is_asset_item": "No", @@ -289,7 +289,7 @@ test_records = [ "item_group": "_Test Item Group Desktops", "is_stock_item": "Yes", "default_warehouse": "_Test Warehouse - _TC", - "default_income_account": "Sales - _TC", + "income_account": "Sales - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC", "is_asset_item": "No", "has_batch_no": "No", diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 6f9cd4f2f2..5de856dee3 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -127,7 +127,7 @@ def get_basic_details(args, item_bean): "item_name": item.item_name, "description": item.description_html or item.description, "warehouse": user_default_warehouse or args.warehouse or item.default_warehouse, - "income_account": item.default_income_account or args.income_account \ + "income_account": item.income_account or args.income_account \ or webnotes.conn.get_value("Company", args.company, "default_income_account"), "expense_account": item.expense_account or args.expense_account \ or webnotes.conn.get_value("Company", args.company, "default_expense_account"),