Odoo Help


Domain from line many2many [Closed]

on 2/17/15, 3:49 AM 1,092 views

The Question has been closed

on 01/21/2016 23:15:34

i have field area_id many2one'wtc_area' and field branch in object wtc_program_subsidi (header).

in object wtc_area i have line branch_ids many2many'wtc.branch'.

i want area_id in form wtc_program subsidi use domain area_id = name in line branch_ids from object wtc_area


how i use domain like this, i have use domain ="{[('area_id,'=',name)]}"...but its not work ,thanks before


On 2/17/15, 4:17 AM

Hello Susi,

First of all: i don't know if we made a mistake when writing your post, but when defining a domain attribute, you don't need to user brackets "{}".

Then, if I understand your need, you want to filter the branch_ids field (from area_id field) with the name value (from wtc_program_subsidi) ?
If yes, i think your domain should be like this : 

domain="[('area_id.branch_ids.name', '=', name)]" (assuming you have a field name on your form)
If name = "test", this domain will filter all areas having branches name equal to "test". 

Hope it helps you,

On 2/17/15, 4:20 AM
  • wtc_program_subsidi
    • area_id (wtc.area m2o)
    • branch_id (wtc.branch)
  • wtc_area
    • branch_ids (wtc.branch m2m)

i want area_id = branch_ids

Samuel Lefever
On 2/17/15, 4:02 AM

If I get it right, you have 3 objects:

  • wtc_program_subsidi
    • area_id (wtc_area m2o)
    • branch (wtc_branch ?)
  • wtc_area
    • branch_ids (wtc_branch m2m)
  • wtc_branch
    • area_ids (wtc_area m2m)

Could you please give us more details about what you are trying to do?

but in wtc_branch i dont have area_ids,, i want in wtc_program_subsidi area_id domain = branch ids,,

on 2/17/15, 4:13 AM

that is not a domain... You want to compare it to what?

Niboo SPRL, Samuel Lefever
on 2/17/15, 4:15 AM



| 5 3 6
Jakarta, Indonesia
On 2/17/15, 4:35 AM
  1. Create a reverse m2m at wtc.branch to get the related wtc_area.
  2. Create a related field at wtc_program_subsidi to propagate the wtc_area related to the selected wtc_branch (field created in 1 need to be accessible from wtc_program_subsidi), for example sake I'll name this wtc_area_related_to_branch.
  3. Use the field created in 2 in the domain of area_id: [('id', 'in', wtc_area_related_to_branch[0][2])]

But be careful if your branch_id is also domained using area_id because you may end up an a situation where you can't select any of them.


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

1 follower(s)


Asked: 2/17/15, 3:49 AM
Seen: 1092 times
Last updated: 1/21/16, 11:15 PM