Browse Source
Merge pull request #506 from max3903/9.0-base_export
Merge pull request #506 from max3903/9.0-base_export
[IMP] base_export_manager - Add Export permission to Access Rightspull/522/head
Maxime Chambreuil
8 years ago
committed by
GitHub
13 changed files with 213 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
-
22base_export_manager/models/res_users.py
-
63base_export_manager/static/src/js/base_export_manager.js
-
4base_export_manager/static/src/xml/base.xml
-
6base_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"?> |
<?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,22 @@ |
|||||
|
# -*- 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' |
||||
|
|
||||
|
@api.model |
||||
|
def fetch_export_models(self): |
||||
|
accessobj = self.env['ir.model.access'] |
||||
|
accessobj_ids = accessobj.search([ |
||||
|
('perm_export', '=', True), |
||||
|
('group_id', 'in', self.env.user.groups_id.ids), |
||||
|
]) |
||||
|
model_names = [ |
||||
|
access_obj.model_id.model for access_obj in accessobj_ids |
||||
|
] |
||||
|
return list(set(model_names)) |
@ -1,10 +1,10 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||
<templates id="template" xml:space="preserve"> |
<templates id="template" xml:space="preserve"> |
||||
|
|
||||
<t t-extend="ExportTreeView-Secondary.children"> |
|
||||
|
<t t-extend="ExportTreeView-Secondary.children"> |
||||
<t t-jquery="#tree-column a" t-operation="append"> |
<t t-jquery="#tree-column a" t-operation="append"> |
||||
(<t t-esc="field.id"/>) |
(<t t-esc="field.id"/>) |
||||
</t> |
</t> |
||||
</t> |
|
||||
|
</t> |
||||
|
|
||||
</templates> |
</templates> |
@ -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