Skip to content

Instantly share code, notes, and snippets.

@kerbrose
Last active November 13, 2024 14:57
Show Gist options
  • Select an option

  • Save kerbrose/a3655d6307e00bbc5ad62131031d1e49 to your computer and use it in GitHub Desktop.

Select an option

Save kerbrose/a3655d6307e00bbc5ad62131031d1e49 to your computer and use it in GitHub Desktop.
useful psql commands
# used to delete a view that contains a removed field
delete from ir_ui_view where position('FIELD_NAME' in arch_db)>0;
# in odoo 16 ir_ui_view becomes a jsonb
delete from ir_ui_view where arch_db->>'en_US' ilike '%FIELD_NAME%' ;
update ir_ui_view set active = FALSE where position('FIELD_NAME' in arch_db)>0;
import psycopg2
conn = psycopg2.connect("dbname=DBNAME user=USER")
cur = conn.cursor()
_1399 = ''' THE VIEW '''
cur.execute("""UPDATE ir_ui_view SET arch_db =%s WHERE id in (1399);""", (_1399,))
conn.commit()
cur.close()
conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment