Community mailing list archives

community@mail.odoo.com

Re: How to use domain in a Many2one

by
Pedro M. Baeza
- 05/19/2015 08:29:56
Weel, you have provided the context, but I supposed that you have a field company_ids in the same model/view, so the correct expresion is:

current_company = fields.Many2one('res.company',domain="[('id','in', company_ids)]")
Take care, that this makes you add always in the view both fields when you add current_company in that view.

Regards.

2015-05-19 14:13 GMT+02:00 Anders Wallenquist <anders.wallenquist@vertel.se>:
I'm trying to use domain to limit the choices in the drop down of a Many2one-field:

current_company = fields.Many2one('res.company',domain="[('id','in',[c.id for c in company_ids])]")

I got this error

Error: Expected "]", got "(name)"

What wrong am I doing?

Regards,

Anders Wallenquist

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe