Commit c73e61ae authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Modify the database schema to add lists2.summary_group and summary_all.

parent eeccbae2
docs/db_schema/database.png

178 KB | W: | H:

docs/db_schema/database.png

180 KB | W: | H:

docs/db_schema/database.png
docs/db_schema/database.png
docs/db_schema/database.png
docs/db_schema/database.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -377,8 +377,11 @@
<row name="columns" null="0" autoincrement="0">
<datatype>text</datatype>
</row>
<row name="features" null="1" autoincrement="0">
<datatype>text</datatype>
<row name="summary_group" null="0" autoincrement="0">
<datatype>boolean</datatype>
<default>NULL</default></row>
<row name="summary_all" null="0" autoincrement="0">
<datatype>boolean</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
......
......@@ -215,10 +215,15 @@ class Report(object):
notnull=migrate,
comment=T(TP_COLUMNS)),
Field("features",
"text",
default=def_features,
comment=T(TP_FEATURES)),
Field("summary_group",
"boolean",
default=True,
label=T("Summary row per group")),
Field("summary_all",
"boolean",
default=True,
label=T("Summary row")),
migrate="lists2.table")
......
......@@ -16,9 +16,15 @@ FIELD_TYPES = {"gridcolumn": "string",
"datecolumn": "date",
"numbercolumn": "float"}
GROUPING_SUMMARY = {"ftype": "groupingsummary",
"groupHeaderTpl": "{name}",
"startCollapsed": False}
MSG_NO_DATAINDEX = "The property dataIndex is missing."
MSG_NO_XTYPE = "The property xtype is missing."
SUMMARY = {"ftype": "summary"}
class ReportException(BaseException):
pass
......@@ -152,9 +158,16 @@ class List2(object):
#
self.grid = Storage(columns=grid_columns, features=[])
features = config.features
if features not in (None, ''):
self.grid.features = json.loads(features)
if config.summary_group or config.summary_all:
features = []
if config.summary_group:
features.append(GROUPING_SUMMARY)
if config.summary_all:
features.append(SUMMARY)
self.grid.features = features
def _add_store_fields(self, column):
......
......@@ -232,12 +232,6 @@ class ReportUi(object):
height=120,
hideLabel=True)
mdf.configure_field("features",
editorHeight=240,
hideLabel=True,
language="json",
xtype="xaceeditorfield")
mdf.configure_field("id_events", emptyText=" ")
mdf.configure_field("query",
......@@ -250,6 +244,14 @@ class ReportUi(object):
hideHeader=True,
minimumRows=10)
mdf.configure_field("summary_group",
labelAlign="right",
labelWidth=170)
mdf.configure_field("summary_all",
labelAlign="right",
labelWidth=170)
#.....................................................................
#
# Form
......@@ -274,7 +276,8 @@ class ReportUi(object):
mdf.merge_fields("columns",
title=T("Columns"))
mdf.merge_fields("features",
mdf.merge_fields("summary_group",
"summary_all",
title=T("Summary"))
mdf.set_mapper(dbui.map_tabpanel)
......@@ -289,13 +292,14 @@ class ReportUi(object):
mdf.hide_columns("columns",
"conditions",
"eval",
"features",
"group_field",
"id_events",
"kwargs",
"query",
"sorters",
"source",
"summary_group",
"summary_all",
"title")
#.....................................................................
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment