minor fixes

This commit is contained in:
Nabin Hait 2014-02-12 16:04:17 +05:30
parent 139dc7b9b2
commit eba1bdbcca
5 changed files with 15 additions and 14 deletions

View File

@ -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)

View File

@ -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"]

View File

@ -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",

View File

@ -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",

View File

@ -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"),