Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/marcwimmer/wodoo
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Wimmer committed Jul 29, 2024
2 parents 2e1b1b5 + 449ae38 commit f81cd14
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = wodoo
version = 0.5.46
version = 0.5.48
description-file = README.md
DESCRIPTION = Odoo Framework
URL = https://github.com/marcwimmer/wodoo
Expand Down
1 change: 1 addition & 0 deletions tmp.JvsOizGxqI/odoo
Submodule odoo added at a62164
1 change: 1 addition & 0 deletions tmp.Z76VWWvLk7/odoo
Submodule odoo added at 129698
46 changes: 45 additions & 1 deletion wodoo/lib_talk.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def queuejobs(config, interval):
return_columns=True,
)
rows = list(rows)
rows[1] = sorted(rows[1], key=lambda x: x[1] == 'total' and 'zzzzzzzz' or x[1])
rows[1] = sorted(rows[1], key=lambda x: x[1] == "total" and "zzzzzzzz" or x[1])
data = {x[1]: x[0] for x in rows[1]}

click.secho(tabulate(rows[1], rows[0], tablefmt="fancy_grid"), fg="yellow")
Expand Down Expand Up @@ -424,4 +424,48 @@ def queuejobs(config, interval):
last_time = arrow.get()


@talk.command()
@click.option("-M", "--module")
@click.argument("model", required=True)
@click.argument("name", required=False)
@pass_config
def views(config, name, module, model):
conn = config.get_odoo_conn()

def _get_xmlid(id):
where = f"model = 'ir.ui.view' and res_id={id}"
sql = (
"SELECT module||'.'|| name as xmlid, model, res_id from ir_model_data "
f"where {where} "
)
rows = _execute_sql(
conn,
sql=sql,
fetchall=True,
return_columns=False,
)
if rows:
return rows[0][0]
return None

where = f"model = '{model}'"
where += "AND inherit_id is null"
rows = _execute_sql(
conn,
sql=f"select id, name from ir_ui_view where {where}",
fetchall=True,
return_columns=True,
)

rows = list(rows)
rows2 = []
for row in rows[1]:
row = list(row)
row.append(_get_xmlid(row[0]))
rows2.append(row)
rows[0] = list(rows[0])
rows[0].append('xmlid')
click.secho(tabulate(rows2, rows[0], tablefmt="fancy_grid"), fg="yellow")


Commands.register(progress)
2 changes: 1 addition & 1 deletion wodoo/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.46
0.5.48

0 comments on commit f81cd14

Please sign in to comment.