Odoo - OpenERP - Restricting Create and Edit for fields with domain filter doesnt work - How to fix?

I have a one2many field. I would like to block the "create and Edit" when referring it in another class.

The below are Working
Field with domain filter

<field name="prod_ser_no_id" domain="[('product_id','=',parent.product_id)]"
    on_change="onchange_serial_id(prod_ser_no_id)" />

Field with selection widget

<field name="prod_ser_no_id" on_change="onchange_serial_id(prod_ser_no_id)" widget="selection"/>

The below is not Working
Field with domain filter and selection widget

<field name="prod_ser_no_id" domain="[('product_id','=',parent.product_id)]"
    on_change="onchange_serial_id(prod_ser_no_id)" widget="selection"/>

| 2 1 2
Asked on 8/14/15, 2:30 PM

If you want many2one Field with domain filter and selection widget, it will not allow.

but you can remove 'Create and Edit...' from many2one field and it looks like a selection widget.

Please follows the steps:

1: Go to : web/addons/web/static/src/js

2: Open view_form.js

3: Go to line number : 2958 or find 'Create and Edit...'

4: remove this line.

Enjoy you can not see the 'Create and Edit...' option.

Note : This will affect each many2one field (version 7.0).

| 2 1 2
Answered on 8/14/15, 2:30 PM

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This forum is for HiTechnologia Employees & just Odoo general knowledge purpose only.

Read Guidelines

Question tools

3 follower(s)


Asked: 8/14/15, 2:30 PM
Seen: 4067 times
Last updated: 8/14/15, 2:30 PM