Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Is there a way to use a domain on a many2many field on openerp v6.1?

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
domainviewmany2many
16 Antwoorden
34323 Weergaven
Avatar
Vivekrajan Rayappan

Hello,

Is it a way to use domain on many2many field on openerp v6.1?

Here is my object : Code:

class user(osv.osv):

_columns={
    'group_ids':fields.many2many('custom_module.group', 'custom_module_group_user_rel', 'user_id', 'group_id', 'Groups'), 
}
user()

class group(osv.osv):

_columns={
    'user_ids':fields.many2many('custom_module.group', 'custom_module_group_user_rel', 'group_id', 'user_id', 'Users'), 
}
group()

I have added these fields on the views and it works fine. My problem is that I'd like to select only users who are in a specific group but I can't find the correct domain to apply.

Here is my view : Code:

<record ..>
...
<field name="name"/>
<field name="group_id"/>
<field name="user_id" domain="[('id','in', [group_id.user_ids]])]"/>
...
</record>

I would like that by selecting a group, the user could only select a user in this group.

Does somebody know what is wrong with my domain ? Or is it possible ?

2
Avatar
Annuleer
Sam path

Hi vivek, you found any solution? even i'm facing the same problem please help me out

Sehrish

Domain on many2many field: http://bit.ly/2DarOfB

Avatar
Mohammad Alhashash
Beste antwoord

Try this

  ...
  <field name="user_id" domain="[('groupd_ids','=', group_id)]"/>
  ...
2
Avatar
Annuleer
Vivekrajan Rayappan
Auteur

Hi Mohammad,

Thanks for your reply. Your suggestion does not work.

Please see the logic inside your filter

<field name="user_id" domain="[('groupd_ids','=', group_id)]"/>

[field name="user_id" domain="[([1,3,4],'=',[1])]

This does not work. Please suggest me something else.

instead of '=' operator, if you have something like 'group_ids','has','group_id', it can work. But we dont have any such operator.

please suggest me a work around to achieve this.

Thank you

Vivekrajan Rayappan
Auteur

Hi, i found a link : http://forum.openerp.com/forum/topic23503.html , but I am not able to use that. If you could give me a sample code, It would be great. Please do the needful

Mohammad Alhashash

Actually x2many field handling in left-hand side of domains does not work as you think. You may have to quote the right-hand side ('group_id' instead of group_id). Check it and tell me the result.

Vivekrajan Rayappan
Auteur

that is also not working. Please see this link and tell me if tat works. http://forum.openerp.com/forum/topic23503.html

Vivekrajan Rayappan
Auteur

Please somebody help me on this.. I am in a big trouble

Mohammad Alhashash

My answer works in v7.0. I'm not sure about version 6.1. Sorry.

Mohammad Alhashash

It should work too in 6.1. Check the line: &lt;field name="stage_id" domain="section_id and [('section_ids', '=', section_id)] or []" /&gt; in addons/cr,/crm_lead_view.xml

Avatar
ClueLogics Technologies Pvt. Ltd.
Beste antwoord

Always use  in operator in domain if you seems need to check more then one such as many2many.



it shoud be domain="[('group_ids','in',[group_id])]"

3
Avatar
Annuleer
Avatar
Vivekrajan Rayappan
Auteur Beste antwoord

Hi Mohammad,

The answer you provided is the right one to filter based on many2many. I actually had the same domain filter in my code. But because of some redundancy of fields, it did not work.

Later I just removed the redundant fields and it worked like a charm.

so, The right answer is what you have suggested at first.

<field name="user_id" domain="[('groupd_ids','=', group_id)]"/>

Thanks for your support and sorry for the delay in updating the answer for my question.

2
Avatar
Annuleer
Mohammad Alhashash

You should not create a new answer for responding. Please read the FAQs. If the answer is correct, you should accept it and use the comment feature for response,

Vivekrajan Rayappan
Auteur

Ok. I shall keep that in mind henceforth. Thanks

Avatar
Gregor Heger
Beste antwoord

@Daniel Blankco

i know it is late, but in case somebody different reads this: function_id is located in the list view function_ids. Thereby, the scope of the domain lies within function_ids. So it it is not possible to address "function_ids" just by writing "function_ids[0][2]". The parent view, in which function_ids is located, has to be adressen. That is why parent. is for.
Entries in the function_ids list are represented by this list: [(6, 0, [1, 2, 3, 4])]. This is a so called x2many code. The ids of the function id fields is located in [1, 2, 3, 4]. So in order to address it, he writes parent.function_ids[0][2].
I don't really know why he is doing that.

0
Avatar
Annuleer
Avatar
namiri
Beste antwoord

try this

<field name="function_id" readonly="False" domain="[('id', 'in', parent.functions_ids[0][2])]"/>

0
Avatar
Annuleer
Ing. Daniel Blanco

@namiri, saw this in another question and post. Could you pleas explain each term inside the domain? I understand that 'id' referes to "the id of function_id", but parent... who is parent in this case? and what [0][2] stands for? refers to the element of the many2one declaration?

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Domain not working in edit mode on Many2many field Opgelost
domain view many2many v14
Avatar
1
sep. 22
3701
Many2many domain works when click search more but wrong values in dropdown
domain many2many
Avatar
0
nov. 22
80
[SOLVED] Create rule using many2many - how to? Opgelost
domain many2many
Avatar
1
jun. 22
8130
Many2many domain not working Opgelost
domain many2many
Avatar
1
jul. 21
3531
Many2many domain not working Opgelost
domain many2many
Avatar
Avatar
1
jul. 21
5042
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now