at the stock reconciliation i’m trying to get the item from the warehouse ordered by item code but when i put order_by=“item_code” at the stock_reconciliation.py file it does not get ordered and keep getting the data randomly from the data base ?
so does anyone have a solution for this problem
seems its working fine
In [1]: frappe.get_list("Customer", fields=['name', 'customer_name'], order_by='customer_name')
Out[1]:
[{u'customer_name': u'da', u'name': u'da'},
{u'customer_name': u'Guest', u'name': u'Guest'},
{u'customer_name': u'Makarand', u'name': u'Makarand'},
{u'customer_name': u'Makarand', u'name': u'Makarand - 1'},
{u'customer_name': u'Ravi', u'name': u'Ravi'},
{u'customer_name': u'SamPal', u'name': u'SamPal'},
{u'customer_name': u'Saurabh Palande', u'name': u'Saurabh Palande'},
{u'customer_name': u'Saurabh Palande', u'name': u'Saurabh Palande - 1'},
{u'customer_name': u'Test', u'name': u'Test'}]
can you share the code?
here is a print screen from my code
@Bassam_Mamdouh Watch out your code in items lists concatenation, the concatenation will end up with no ordered concatenated list, and frappe.get_list is working just fine.
Hope that helps,
no its not because of concatenating as even when i comment the first items line from bin doctype and adjusted the second line also the list is not ordered.
so or so i opened an issue and discussing this with one of the founders so when we get a solution for this it will be published with an update or i will share the solution here.
thanks for your reply
I have just executed it in the console and get it properly there as listed down
In [1]: frappe.get_list("User", fields=['first_name'], order_by='first_name')
Out[3]:
[{‘first_name’: ‘Ahmed’},
{‘first_name’: ‘Guest’},
{‘first_name’: ‘saed’},
{‘first_name’: ‘test’}]
In [4]: In [1]: frappe.get_list(“User”, fields=[‘first_name’], order_by=‘first_name’, as_list=1)
Out[4]: ((‘Ahmed’,), (‘Guest’,), (‘saed’,), (‘test’,))
try to execute your query in the console and get the feedback