fix: dayofyear unit function for child table query

This commit is contained in:
prssanna 2020-02-17 18:56:30 +05:30
parent f4d5e9ea0d
commit cfdc24aef5
2 changed files with 2 additions and 2 deletions

View file

@ -186,7 +186,7 @@ def get_unit_function(doctype, datefield, timegrain):
unit_function = ''
if timegrain=='Daily':
if frappe.db.db_type == 'mariadb':
unit_function = 'dayofyear({datefield})'.format(
unit_function = 'dayofyear(`tab{doctype}`.{datefield})'.format(
doctype=doctype, datefield=datefield)
else:
unit_function = 'extract(doy from `tab{doctype}`.{datefield})'.format(

View file

@ -261,7 +261,7 @@ class DatabaseQuery(object):
if self.fields:
for f in self.fields:
if ( not ("tab" in f and "." in f) ) or ("locate(" in f) or ("strpos(" in f) or \
("count(" in f) or ("avg(" in f) or ("sum(" in f) or ("extract(" in f):
("count(" in f) or ("avg(" in f) or ("sum(" in f) or ("extract(" in f) or ("dayofyear(" in f):
continue
table_name = f.split('.')[0]