Odoo Help

Welcome!

This community 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.

0

Domain from line many2many [Closed]

By
Susi
on 2/17/15, 3:49 AM 689 views

The Question has been closed

by
Susi
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

 

1
Bruno PLANCHER
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,
Regards

0
Susi
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

0
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,,

Susi
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
0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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