我正在尝试修改下面的代码,但出现“元组索引超出范围”错误。
price_list_name = frappe.db.sql("""select name
from `tabItem Price` a
where a.item_code = %s and a.selling = 1
and a.uom = %s
and a.creation = (select max(b.creation) from `tabItem Price` b
where a.item_code = b.item_code and b.selling = 1)""",(d.item_code, d.uom))
frappe.log(price_list_name)
name = price_list_name[0][0]
price_doc = frappe.get_doc("Item Price",name)
这是错误消息:
File "/home/frappe/erpnext/apps/xlevel_sales/xlevel_sales/custom_method.py", line 27, in update_item_price_list
name = price_list_name[0][0]
IndexError: tuple index out of range