Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I need to make CSV import option (for all models) only available to certain security groups in Odoo v8.
How to do that? Any hint?
--- UPDATE ---
I have created a specific security group and category for CSV import.
A) No security rules
I cannot create security rules over TransientModels (Why? Whyyyy?), therefore I cannot use this over base_import.import model. (Damn! That would have been easy for once!)
B) No xml "groups" allowed for non-visual elements
In addons/base_import/views/base_import.xml there are these lines:
<template id="assets_backend" name="base_import assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/base_import/static/src/css/import.css"/>
But, even I can modify that xpaths and avoid those link and 2 scripts, I cannot make it group-based optional using "groups" attribute, as it is completely ignored (Does "groups" only apply to visual elements like fields, divs, groups and so?)
C) Is it even possible to check groups with t-if? No clue how.
In addons/base_import/static/src/xml/import.xml there are these lines:
<t t-jquery="span.oe_alternative" t-operation="append">
<a href="#" class="oe_bold oe_list_button_import">Import</a>
But once again, I have no clue how to add a t-if for that "a href" checking if current user belongs to a specific group I have created for csv import.
Documentation says nothing about hot to check it in QWeb views.
D) JS? Really?
Haven't even tried it. Should be easier.
the best solution for this is simple, just a configuration trick :
go to Configuration (make sure your admin user have access to Technical settings)
go to user interface / views
search for base_import assets
go to Group page, then add the admin group.
then refresh the user then the import button is gone (y)
PS : i tried this using odoo V8
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 4/5/15, 10:35 PM|
|Seen: 2554 times|
|Last updated: 6/22/17, 8:17 AM|