Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
9 ตอบกลับ
27054 มุมมอง

Hi, I'm trying to make a custom view for users with very limited access rights that contains a One2Many widget. The widget is readOnly so they can't edit anything but the problem is that they can still click on the lines and the detail is shown with more information, that they should not be able to see. It would be fine if the lines of widget were text lines..is it possible?

(I'm using OpenERP 6.1)

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Set the one2many field as readonly and nobody will can use it.

<field name="your_o2m" readonly="1" />
อวตาร
ละทิ้ง
ผู้เขียน

as I said...it already is readonly, but users are still able to click on the lines and popup with details is shown....which I want to forbid

Set the o2m as editable so it doesn't show any popup. <field name="your_o2m" readonly="1" editable="top"/>

คำตอบที่ดีที่สุด

You can use the options - no_open, to set the field in read mode: do not render as a link.

For example:

<field name="field_name" options="{'no_create': True}"/>
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

I think it's not possible. For workaround I use functional field with type='char' to only show the value of original field. I make functional field visible for users with limited access rights and invisible for normal users and vice versa visibility for original field.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi (i'm new in Odoo) i think i found a workaround. Instead of remove the "clickable" behavior, i redefined the view form for this field. By this way i can filter what the user can see!

In this example, i want to show only  the field "name", and "facture_id" of my model Facture; i dont want people to see the price and other field when they clicked on field facture_ids.

So here is my code : 

<field name="facture_ids" widget="one2many_list"  readonly="1" >

    <tree editable="top">

        <field name="patient"/>

        <field name="facture_id" />

    </tree>

    <form>

        <sheet>

            <field name="name"/>

            <field name="facture_id" />

        </sheet>

    </form>

</field>

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

<field name="field_m2o" options="{'no_create': True}" />

can delete "create and edit" option and let you search in selection

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

New user here. Combining

 Francesco OpenCode's answer and Hamza YAYA's answer made it work for me

อวตาร
ละทิ้ง

Can you please post the answer .

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ธ.ค. 21
28150
0
ก.ค. 16
4274
7
ธ.ค. 23
33181
1
มี.ค. 15
6342
2
ก.ค. 24
830