diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 2f6222cd2e..02b936076b 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1 +1 @@ -__version__ = '4.22.0' +__version__ = '4.22.1' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 094a8a5991..e033c7b00e 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -4,7 +4,7 @@ app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "4.22.0" +app_version = "4.22.1" error_report_email = "support@erpnext.com" diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 5145e0ab17..7633bc91fc 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -144,16 +144,13 @@ def get_basic_details(args, item_doc): "warehouse": user_default_warehouse or args.warehouse or item.default_warehouse, "income_account": (item.income_account or args.income_account - or frappe.db.get_value("Item Group", item.item_group, "default_income_account") - or frappe.db.get_value("Company", args.company, "default_income_account")), + or frappe.db.get_value("Item Group", item.item_group, "default_income_account")), "expense_account": (item.expense_account or args.expense_account - or frappe.db.get_value("Item Group", item.item_group, "default_expense_account") - or frappe.db.get_value("Company", args.company, "default_expense_account")), + or frappe.db.get_value("Item Group", item.item_group, "default_expense_account")), "cost_center": (frappe.db.get_value("Project", args.project_name, "cost_center") or (item.selling_cost_center if args.transaction_type == "selling" else item.buying_cost_center) - or frappe.db.get_value("Item Group", item.item_group, "default_cost_center") - or frappe.db.get_value("Company", args.company, "cost_center")), + or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")), "batch_no": None, "item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in item_doc.get("item_tax")))), @@ -171,6 +168,12 @@ def get_basic_details(args, item_doc): "discount_percentage": 0.0 }) + # if default specified in item is for another company, fetch from company + for d in [["Account", "income_account", "default_income_account"], ["Account", "expense_account", "default_expense_account"], + ["Cost Center", "cost_center", "cost_center"], ["Warehouse", "warehouse", ""]]: + if not out[d[1]] or args.company != frappe.db.get_value(d[0], out.get(d[1]), "company"): + out[d[1]] = frappe.db.get_value("Company", args.company, d[2]) if d[2] else None + for fieldname in ("item_name", "item_group", "barcode", "brand", "stock_uom"): out[fieldname] = item.get(fieldname) diff --git a/setup.py b/setup.py index bd97e86d9b..42385e87d9 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import os -version = "4.22.0" +version = "4.22.1" with open("requirements.txt", "r") as f: install_requires = f.readlines()