Last active
December 22, 2015 07:08
-
-
Save ecarreras/6435455 to your computer and use it in GitHub Desktop.
permisos taules forànies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| 'access_' || replace(m.model, '.', '_') as id, | |
| m.model as name, md.module ||'.'||'model_' || replace(m.model, '.', '_') as "model_id:id", | |
| coalesce(gd.module ||'.', '') || g.name as "group_id:id", | |
| a.perm_read::int as perm_read, | |
| a.perm_write::int as perm_write, | |
| a.perm_create::int as perm_create, | |
| a.perm_unlink::int as perm_unlink | |
| FROM | |
| ir_model_access a | |
| left join ir_model m on (a.model_id = m.id) | |
| left join ir_model_data md on (md.res_id = m.id and md.model = 'ir.model') | |
| left join res_groups g on (a.group_id = g.id) | |
| left join ir_model_data gd on (gd.res_id = g.id and gd.model = 'res.groups') | |
| where | |
| group_id = 22; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| DISTINCT imd2.module || '.model_' || replace(imf.relation, '.', | |
| '_') | |
| FROM ir_model_data imd INNER JOIN ir_model_fields imf | |
| ON (imd.res_id = imf.id AND imf.ttype IN ('many2one', 'one2many', | |
| 'many2many') AND | |
| imf.relation IS NOT null) | |
| INNER JOIN ir_model imm | |
| ON (imf.relation = imm.model) | |
| INNER JOIN ir_model_data imd2 | |
| ON (imm.id = imd2.res_id AND imd2.model = 'ir.model' AND imd2.module != | |
| 'giscedata_polissa') | |
| WHERE imd.model = 'ir.model.fields' AND imd.module = | |
| 'giscedata_polissa'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment