Odoo Help


XML : Widget = "selection" not working on many2one field openerpv7

Yassine TEIMI
on 12/12/14, 9:32 AM 2,208 views

I have a many2one field : 'Numeros_bl': fields.many2one('stock.picking', 'Numeros Bls', readonly=True),

On xml I made : 

<field name="Numeros_bl" widget="selection" domain="[('state','=','done'),('invoice_state','=','2binvoiced'),('partner_id','=',partner_id)]"/>

Invalid XML architecture as error. Nothing else in the traceback.

Why it's not accepting the widget ?



Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 12/18/14, 12:59 PM

widget="selection" doesn't support dynamic domains. If you need dynamic domain you have to remove the widget.
But the static domain like <field name="Numeros_bl" widget="selection" domain="[('state','=','done')]"/> will work.
Selection widgets are pre-filtered server-side, and are not meant for dynamic domains, so this will not work and is not a bug.
This is a limitation of all OpenERP version so far (including 6.0), due to semantics of the fields.selection column type.

Devang Pipaliya
On 12/18/14, 7:30 AM

@Yassine Can you Show full error stack here please.

Juan Carlos
On 12/18/14, 10:13 AM

The field Many2one already is a selection box, delete " widget="selection" " and this is all.

@Juan many2one widget and selection widget serves different purpose. Selection widget is used if you want user to just select from the list, without capability to search more or even create/edit. Many2one provides those capabilities.

on 12/18/14, 12:14 PM

Oh!, thanks for the clarification, I didn't know this.

Juan Carlos
on 12/18/14, 12:55 PM



| 5 3 6
Jakarta, Indonesia
On 12/18/14, 10:05 AM

Selection widget cannot accept domain.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 12/12/14, 9:32 AM
Seen: 2208 times
Last updated: 7/30/15, 5:12 AM