Ver código fonte

show child table values in doclistview

version-14
Anand Doshi 13 anos atrás
pai
commit
3ac7bf6430
1 arquivos alterados com 11 adições e 2 exclusões
  1. +11
    -2
      py/webnotes/widgets/doclistview.py

+ 11
- 2
py/webnotes/widgets/doclistview.py Ver arquivo

@@ -58,12 +58,19 @@ def get(arg=None):
if not data.get('order_by'):
data['order_by'] = tables[0] + '.modified desc'
if len(tables) > 1:
data['group_by'] = "group by " + tables[0] + ".name"
else:
data['group_by'] = ''

check_sort_by_table(data.get('order_by'), tables)
add_limit(data)
query = """select %(fields)s from %(tables)s where %(conditions)s
order by %(order_by)s %(limit)s""" % data
%(group_by)s order by %(order_by)s %(limit)s""" % data

return webnotes.conn.sql(query, as_dict=1)

def check_sort_by_table(sort_by, tables):
@@ -132,7 +139,7 @@ def build_conditions(filters):

# match conditions
build_match_conditions(data, conditions)
return conditions
def build_filter_conditions(data, filters, conditions):
@@ -175,6 +182,8 @@ def get_tables():
# add tables from fields
for f in json.loads(data['fields']):
table_name = f.split('.')[0]
if table_name.lower().startswith('group_concat('):
table_name = table_name[13:]
# check if ifnull function is used
if table_name.lower().startswith('ifnull('):
table_name = table_name[7:]


Carregando…
Cancelar
Salvar