Explorar el Código

fix(minor): handle as fieldnames

version-14
Rushabh Mehta hace 4 años
padre
commit
0def97543b
Se han modificado 1 ficheros con 6 adiciones y 3 borrados
  1. +6
    -3
      frappe/desk/reportview.py

+ 6
- 3
frappe/desk/reportview.py Ver fichero

@@ -111,15 +111,18 @@ def extract_fieldname(field):
if ',' in field:
raise_invalid_field(field)

fieldname = field.split(" as ")[0]
fieldname = field
for sep in (' as ', ' AS '):
if sep in fieldname:
fieldname = fieldname.split(sep)[0]

# certain functions allowed, extract the fieldname from the function
if (fieldname.startswith('count(')
or fieldname.startswith('sum(')
or fieldname.startswith('avg(')):
if not fieldname.endswith(')'):
if not fieldname.strip().endswith(')'):
raise_invalid_field(field)
fieldname = fieldname.split('(', 1)[1].split(')')[0]
fieldname = fieldname.split('(', 1)[1][:-1]

return fieldname



Cargando…
Cancelar
Guardar