Merge branch 'develop'
This commit is contained in:
commit
5aa465ae44
@ -1 +1 @@
|
||||
__version__ = '4.22.0'
|
||||
__version__ = '4.22.1'
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user