def build_description_standard(meta, tl): desc = frappe.db.get_description() colnames, coltypes, coloptions, colwidths = [], [], [], [] # merged metadata - used if we are unable to # get both the table name and field name from # the description - in case of joins merged_meta = {} for d in meta: merged_meta.update(meta[d]) for f in desc: fn, dt = f[0], '' if '.' in fn: dt, fn = fn.split('.') if (not dt) and merged_meta.get(fn): # no "AS" given, find type from merged description desc = merged_meta[fn] colnames.append(desc[0] or fn) coltypes.append(desc[1] or '') coloptions.append(desc[2] or '') colwidths.append(desc[3] or '100') elif meta.get(dt, {}).has_key(fn): # type specified for a multi-table join # usually from Report Builder desc = meta[dt][fn] colnames.append(desc[0] or fn) coltypes.append(desc[1] or '') coloptions.append(desc[2] or '') colwidths.append(desc[3] or '100') else: # nothing found # guess colnames.append(fn) coltypes.append(guess_type(f[1])) coloptions.append('') colwidths.append('100') return colnames, coltypes, coloptions, colwidths
def build_description_standard(meta, tl): desc = frappe.db.get_description() colnames, coltypes, coloptions, colwidths = [], [], [], [] # merged metadata - used if we are unable to # get both the table name and field name from # the description - in case of joins merged_meta = {} for d in meta: merged_meta.update(meta[d]) for f in desc: fn, dt = f[0], '' if '.' in fn: dt, fn = fn.split('.') if (not dt) and merged_meta.get(fn): # no "AS" given, find type from merged description desc = merged_meta[fn] colnames.append(desc[0] or fn) coltypes.append(desc[1] or '') coloptions.append(desc[2] or '') colwidths.append(desc[3] or '100') elif fn in meta.get(dt,{}): # type specified for a multi-table join # usually from Report Builder desc = meta[dt][fn] colnames.append(desc[0] or fn) coltypes.append(desc[1] or '') coloptions.append(desc[2] or '') colwidths.append(desc[3] or '100') else: # nothing found # guess colnames.append(fn) coltypes.append(guess_type(f[1])) coloptions.append('') colwidths.append('100') return colnames, coltypes, coloptions, colwidths
for f in desc: fn, dt = f[0], '' if '.' in fn: dt, fn = fn.split('.') if (not dt) and merged_meta.get(fn): # no "AS" given, find type from merged description desc = merged_meta[fn] colnames.append(desc[0] or fn) coltypes.append(desc[1] or '') coloptions.append(desc[2] or '') colwidths.append(desc[3] or '100') <<<<<<< HEAD elif meta.get(dt,{}).has_key(fn): ======= elif fn in meta.get(dt,{}): >>>>>>> 176d241496ede1357a309fa44a037b757a252581 # type specified for a multi-table join # usually from Report Builder desc = meta[dt][fn] colnames.append(desc[0] or fn) coltypes.append(desc[1] or '') coloptions.append(desc[2] or '') colwidths.append(desc[3] or '100') else: # nothing found # guess