This question has been flagged
4 Replies
6072 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 ?

 

Avatar
Discard
Best Answer

Hi,
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.

Avatar
Discard
Best Answer

@Yassine Can you Show full error stack here please.

Avatar
Discard
Best Answer

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

Avatar
Discard

@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.

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

Best Answer

Selection widget cannot accept domain.

Avatar
Discard