Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
8 Trả lời
6186 Lượt xem

Hi everyone,

I have 3 users administrator,general admin,system admin ..if iam logging in with administrator he can view only data so create and edit should be disabled.

if iam logging in with other two users create and edit should work.

How to disable create and edit disable for admin.

Thanku

Ảnh đại diện
Huỷ bỏ

is the administrator you refer is the default admin ? i mean the user having the id=1

Tác giả

yes deafult admin

Câu trả lời hay nhất

Hi Savita,

You can override the ORM method(s) in your custom module and raise the exception if user is admin.

Reference: Override base ORM methods

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com  website: http://www.erpharbor.com
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Hi,

I got solution.

<record id="asset_view_tree_noedit" model="ir.ui.view">

<field name="name">assets.creation</field>

<field name="model">assets.creation</field>

<field name="inherit_id" ref="asset_view_tree"/>

<field name="groups_id" eval="[(4, [ref('base.group_erp_manager') ])]"/>

<field name="arch" type="xml">

<xpath expr='//tree' position='attributes'>

<attribute name="edit">false</attribute>

</xpath>

<xpath expr='//tree' position='attributes'>

<attribute name="create">false</attribute>

</xpath>

</field>

</record>


Its working

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Do not touch the default admin and do not use it for operational purposes if you want to avoid serious problems.

Ảnh đại diện
Huỷ bỏ
Tác giả

then how it can be done?

It does not need to be done. Keep the default admin hidden adn save and create your additional admins as many and how you like by copying the default admin and adapting it.

Câu trả lời hay nhất

Hi,

Hiding the create and edit of the default admin didn't make any sense.  Because if you hide admin's create and edit option from any view.

The admin user can still activate it or play around with it, from the settings menu.

Thanks


Ảnh đại diện
Huỷ bỏ