Technical mailing list archives


Re: Dynamically assign a domain in Odoo 10 CE

Chidozie Kingsley Okonkwo
- 2018年08月28日 12時26分46秒
Maybe this can help you: Odoo how domain attribute works?

<td class="ydp8376d6cccard-primary-image-cell" background="" bgcolor="#000000" valign="top" height="175" style="background-color: rgb(0, 0, 0); background-size: cover; position: relative; border-radius: 2px 2px 0px 0px; min-height: 175px;">

Odoo how domain attribute works?

I have a One2many relation in my odoo ' student .student' model that's it result_ids = fields.One2many("scho...

On Tuesday, August 28, 2018, 5:25:10 PM GMT+1, Christian Zöllner <> wrote:


typically you need the fields you depend on on that model form view. They can be visible or invisible.

Let's look at an easy example the partner category. That category should be obviously on res.partner (category_id) and crm.lead (partner_category_id).

Your partner_id field domain in the crm.lead form view should be [('category_id', '=?', partner_category_id)]. Why the operator '=?' --> if partner_category_id is None/False the whole domain will result in a true and therefore show all partners.

Best Regards

Von: "Johan Van Hirtum" <>
An: "Odoo S.A. Technical" <>
Gesendet: Dienstag, 28. August 2018 17:50:22
Betreff: Dynamically assign a domain in Odoo 10 CE

Dear Odoo experts,


We have a many2one ( or maybe a many2many ) field in a form view and we want the search domain for this field to be depending on another field on the form. For example in CRM, we want the search list for the partner_id to be restricted to a partner category or a company or a city depending on the sales channel or a campaign. We have tried a lot of things but we cannot achieve this. Can someone point us in the right direction please ?


With kind regards,



Van Hirtum Johan

Post to:

Christian Zöllner

Intero Technologies GmbH
Heinrich-Heine-Ring 76
D - 18435 Stralsund
Tel:  +49 (0) 3831 – 44 55 7 - 0
Fax:  +49 (0) 3831 – 44 55 7 - 79


Intero Technologies GmbH • Firmensitz: Heinrich-Heine-Ring 76, 18435 Stralsund , Deutschland • Registergericht: Amtsgericht Stralsund, HRB 7076 • Geschäftsführer: Frank Löffler, Lars Lifson • USt-Ident.Nr. DE 251251697

This eMail and its content is dedicated to the intended recipient only. If you have received it in error please contact the sender immediately by fax or return eMail. Please then delete the eMail and any copies of it.

Post to: