sss
sss

Reputation: 107

Change behaviour of many2many field in odoo 12

I write this question after much search without finding any answer.

So as in one2many field after adding editable="top/bottom" is able to create record in same form. My question: is it possible for many2many field? Meaning in many2many field there is create and edit option.

After clicking on create and edit it will pop up default model form view, but i don't want it. After click on create and edit option it will able to display any other custom form view or it will display other form field where many2many field is available.

Is it possible? If yes how's it possible and if not is any other alternative way available.

I have attached screenshot in click on red highlighted part it will redirect to green highlighted part.

Please help. Thanks in advance for your time.

enter image description here

Upvotes: 3

Views: 855

Answers (1)

Charif DZ
Charif DZ

Reputation: 14721

Yes it's possible to specify witch form should the many2one show when creating or editing a record, it's by using context attribute:

<field name="your_many2one_field_name"
         context="{'form_view_ref':'app_name.xmlID_of_form'}" />

This spacial key works also for x2many field and there is other like tree_view_ref, kanban_view_ref.

There is no easy way to do what you want by default clicking on create and edit button or open button opens a form view.

Upvotes: 1

Related Questions