[IMP] bi_sql_editor : Allow to use sum / avg operator on tree view

This commit is contained in:
Sylvain LE GAL
2024-01-12 01:12:26 +01:00
parent 26cf0f9912
commit c5615e3b14
2 changed files with 10 additions and 1 deletions

View File

@@ -265,8 +265,14 @@ class BiSQLViewField(models.Model):
elif self.tree_visibility == "optional_show":
visibility_text = 'optional="show"'
operator_text = ""
if self.group_operator == "sum":
operator_text = f'sum="{_("Total")}"'
elif self.group_operator == "avg":
operator_text = f'avg="{_("Average")}"'
return (
f"""<field name="{self.name}" {visibility_text}"""
f"""<field name="{self.name}" {visibility_text} {operator_text}"""
f""" context="{self.field_context}"/>\n"""
)