Community mailing list archives

community@mail.odoo.com

Re: How to use domain in a Many2one

by
Pedro M. Baeza
- 05/19/2015 12:26:34
What I said, I don't have enought context to say. Put more information.

Regards.

2015-05-19 16:12 GMT+02:00 Anders Wallenquist <anders.wallenquist@vertel.se>:
Den 2015-05-19 14:35, Pedro Manuel Baeza Romero skrev:
<blockquote cite="mid:CACSANCASbbbrXC0QAVhCYGm9N5tH5jdMTWFQrCTp+7ZSHP1ryg@mail.gmail.com" type="cite">
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.
Thanks, but I got this error intead:
TypeError: not all arguments converted during string formatting


Regards,

Anders
<blockquote cite="mid:CACSANCASbbbrXC0QAVhCYGm9N5tH5jdMTWFQrCTp+7ZSHP1ryg@mail.gmail.com" type="cite">

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


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


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