Skip to content

Commit

Permalink
[IMP]bi_sql_editor: many2one fields clickable on the list view if set…
Browse files Browse the repository at this point in the history
…ting is enabled
  • Loading branch information
GuillemCForgeFlow committed Jun 4, 2024
1 parent c3f636d commit 53d0a05
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
15 changes: 13 additions & 2 deletions bi_sql_editor/models/bi_sql_view_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ class BiSQLViewField(models.Model):
" a 'group by' option in the search view",
)

is_many2one_clickable = fields.Boolean(
default=True,
help="If the field is of type Many2one and the option is enabled, the"
"field will be clickable on the list view.",
)

index_name = fields.Char(string="Index Name", compute="_compute_index_name")

graph_type = fields.Selection(string="Graph Type", selection=_GRAPH_TYPE_SELECTION)
Expand Down Expand Up @@ -207,8 +213,13 @@ def _prepare_tree_field(self):
self.ensure_one()
res = ""
if self.field_description and self.tree_visibility != "unavailable":
res = """<field name="{}" {}/>""".format(
self.name, self.tree_visibility == "hidden" and 'invisible="1"' or ""
res = """<field name="{}" {} {}/>""".format(
self.name,
self.tree_visibility == "hidden" and 'invisible="1"' or "",
self.ttype == "many2one"
and self.is_many2one_clickable
and 'widget="many2one"'
or "",
)
return res

Expand Down
3 changes: 2 additions & 1 deletion bi_sql_editor/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ To configure this module, you need to:
* Once the sql request checked, the module analyses the column of the view,
and propose field mapping. For each field, you can decide to create an index
and set if it will be displayed on the pivot graph as a column, a row or a
measure.
measure. On top of that, if the field is of type Many2one, you can also
select the option to be clickable on the list view.

.. figure:: ../static/description/03_field_mapping.png
:width: 800 px
Expand Down
4 changes: 4 additions & 0 deletions bi_sql_editor/views/view_bi_sql_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
('field_description', '!=', False),
('ttype', '=', 'many2one')]}"
/>
<field
name="is_many2one_clickable"
attrs="{'invisible': ['|', ('field_description', '=', False), ('ttype', '!=', 'many2one')]}"
/>
<field
name="selection"
attrs="{
Expand Down

0 comments on commit 53d0a05

Please sign in to comment.