Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
19531 Widoki

Hello,  I am having trouble opening a custom form view that is restricted to a group if a user clicks a many2one field from a parent view.  For example, I have a Project Developer group that may see the partner_id field on a Project Issue form.  If the Developer clicks the partner_id field, then it should open a custom Partner form view with restricted information.  Right now it is opening the base partner form view, and shows too much information.  Does anyone know how to open a custom partner form view when clicking on a many2one, partner_id field?


I found this example here, but it isn't working for me:  

https://www.odoo.com/forum/help-1/question/how-to-choose-form-view-used-by-many2one-field-in-openerp-v7-13709


Thank you for your help

Awatar
Odrzuć
Najlepsza odpowiedź

You can do this by adding context on the field in XML.

<field name="m2o_field" context="{'form_view_ref': 'module_name.view_name'}" />

Alternatively, the answer in the link you gave is also correct.

<field name="m2o_field">
    <form>
        <!-- form view here -->
    </form>
</field>


Awatar
Odrzuć
Najlepsza odpowiedź

Hi Andre de Kock

That works, but when you reload that screen, it will not show the same which you have added through the context.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lut 25
8388
2
paź 19
3984
2
paź 19
3438
3
sty 19
7028
2
cze 15
8024