浏览代码

Show zero rate column in the print if print_hide_if_no_value is disabled (#4694)

version-14
rohitwaghchaure 7 年前
committed by Nabin Hait
父节点
当前提交
5d6fdb8f05
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. +5
    -2
      frappe/www/printview.py

+ 5
- 2
frappe/www/printview.py 查看文件

@@ -398,7 +398,7 @@ def get_visible_columns(data, table_meta, df):
doc = data[0] or frappe.new_doc(df.options) doc = data[0] or frappe.new_doc(df.options)
def add_column(col_df): def add_column(col_df):
return is_visible(col_df, doc) \ return is_visible(col_df, doc) \
and column_has_value(data, col_df.get("fieldname"))
and column_has_value(data, col_df.get("fieldname"), col_df)


if df.get("visible_columns"): if df.get("visible_columns"):
# columns specified by column builder # columns specified by column builder
@@ -418,10 +418,13 @@ def get_visible_columns(data, table_meta, df):


return columns return columns


def column_has_value(data, fieldname):
def column_has_value(data, fieldname, col_df):
"""Check if at least one cell in column has non-zero and non-blank value""" """Check if at least one cell in column has non-zero and non-blank value"""
has_value = False has_value = False


if col_df.fieldtype in ['Float', 'Currency'] and not col_df.print_hide_if_no_value:
return True

for row in data: for row in data:
value = row.get(fieldname) value = row.get(fieldname)
if value: if value:


正在加载...
取消
保存