Sandip Mangukiya
9 years ago
committed by
Olivier Jossen
13 changed files with 217 additions and 30 deletions
-
36base_export_manager/README.rst
-
8base_export_manager/__openerp__.py
-
8base_export_manager/data/ir_exports_data.xml
-
1base_export_manager/models/__init__.py
-
12base_export_manager/models/ir_model_access.py
-
26base_export_manager/models/res_users.py
-
67base_export_manager/static/src/js/base_export_manager.js
-
8base_export_manager/static/src/xml/base.xml
-
20base_export_manager/views/assets.xml
-
0base_export_manager/views/ir_exports.xml
-
15base_export_manager/views/ir_model.xml
-
28base_export_manager/views/ir_model_access.xml
-
18base_export_manager/views/res_groups.xml
@ -1,8 +1,6 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
<odoo> |
|||
|
|||
<function model="ir.exports.line" name="_install_base_export_manager"/> |
|||
<function model="ir.exports.line" name="_install_base_export_manager"/> |
|||
|
|||
</data> |
|||
</openerp> |
|||
</odoo> |
@ -0,0 +1,12 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2016 - Ursa Information Systems <http://ursainfosystems.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) |
|||
|
|||
|
|||
from openerp import models, fields |
|||
|
|||
|
|||
class IrModelAccess(models.Model): |
|||
_inherit = 'ir.model.access' |
|||
|
|||
perm_export = fields.Boolean('Export Access', default=True) |
@ -0,0 +1,26 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2016 - Ursa Information Systems <http://ursainfosystems.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) |
|||
|
|||
|
|||
from openerp import api, models |
|||
|
|||
|
|||
class ResUsers(models.Model): |
|||
_inherit = 'res.users' |
|||
|
|||
def get_export_models(self): |
|||
self.env.cr.execute("SELECT model " |
|||
"FROM ir_model " |
|||
"WHERE id IN (" |
|||
" SELECT distinct(model_id) " |
|||
" FROM ir_model_access " |
|||
" WHERE perm_export=TRUE AND group_id IN (" |
|||
" SELECT gid " |
|||
" FROM res_groups_users_rel " |
|||
" WHERE uid=%s" |
|||
" )" |
|||
")", |
|||
(self.env.uid,)) |
|||
model_names = [r[0] for r in self.env.cr.fetchall()] |
|||
return model_names |
@ -1,10 +1,10 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<templates id="template" xml:space="preserve"> |
|||
|
|||
<t t-extend="ExportTreeView-Secondary.children"> |
|||
<t t-jquery="#tree-column a" t-operation="append"> |
|||
(<t t-esc="field.id"/>) |
|||
<t t-extend="ExportTreeView-Secondary.children"> |
|||
<t t-jquery="#tree-column a" t-operation="append"> |
|||
(<t t-esc="field.id"/>) |
|||
</t> |
|||
</t> |
|||
</t> |
|||
|
|||
</templates> |
@ -1,15 +1,15 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<!-- Add Javascript --> |
|||
<template id="assets_backend" |
|||
inherit_id="web.assets_backend" |
|||
name="Add technical name to field items" |
|||
priority="20"> |
|||
<xpath expr="." position="inside"> |
|||
<script type="text/javascript" |
|||
src="/base_export_manager/static/src/js/base_export_manager.js"/> |
|||
</xpath> |
|||
</template> |
|||
<!-- Add Javascript --> |
|||
<template id="assets_backend" |
|||
inherit_id="web.assets_backend" |
|||
name="Add technical name to field items" |
|||
priority="20"> |
|||
<xpath expr="." position="inside"> |
|||
<script type="text/javascript" |
|||
src="/base_export_manager/static/src/js/base_export_manager.js"/> |
|||
</xpath> |
|||
</template> |
|||
|
|||
</odoo> |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0"?> |
|||
<odoo> |
|||
|
|||
<record id="ir_model_view_form" model="ir.ui.view"> |
|||
<field name="name">ir.model.form.base_export_manager</field> |
|||
<field name="model">ir.model</field> |
|||
<field name="inherit_id" ref="base.view_model_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='access_ids']//tree//field[@name='perm_unlink']" position="after"> |
|||
<field name="perm_export"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0"?> |
|||
<odoo> |
|||
|
|||
<record id="ir_model_access_view_tree" |
|||
model="ir.ui.view"> |
|||
<field name="name">ir.model.access.tree.base_export_manager</field> |
|||
<field name="model">ir.model.access</field> |
|||
<field name="inherit_id" ref="base.ir_access_view_tree"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='perm_unlink']" position="after"> |
|||
<field name="perm_export"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="ir_model_access_view_form" |
|||
model="ir.ui.view"> |
|||
<field name="name">ir.model.access.form.base_export_manager</field> |
|||
<field name="model">ir.model.access</field> |
|||
<field name="inherit_id" ref="base.ir_access_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='perm_unlink']" position="after"> |
|||
<field name="perm_export"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0"?> |
|||
<odoo> |
|||
|
|||
<record id="res_groups_view_form" model="ir.ui.view"> |
|||
<field name="name">res.groups.form</field> |
|||
<field name="model">res.groups</field> |
|||
<field name="inherit_id" ref="base.view_groups_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='model_access']//tree//field[@name='perm_unlink']" position="after"> |
|||
<field name="perm_export"/> |
|||
</xpath> |
|||
<xpath expr="//field[@name='model_access']//form//field[@name='perm_unlink']" position="after"> |
|||
<field name="perm_export"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue