Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

ver.14: filter Many2one field with another Many2one field selected.

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
many2onefilter_domainv14
1 Răspunde
7305 Vizualizări
Imagine profil
SmithJohn45

hello all,

requirement: want to have same zone to select Rider the Customer is in. (both are in same table) --in below code, last line contains rider_id field, first condition is working fine--

it is showing error as below (searched here and google for "Invalid composed field" but no luck):

Invalid composed field user_id.zone_id in field rider_id default domain ([('category_id.name','ilike','rider'),('zone_id','=',user_id.zone_id)])

definitely i am doing wrong here, please help to correct it.

my model:

class Orders(models.Model):
    _name = 'tests.testsorders'
    _rec_name = 'name'
    _description = "Tests Orders"
    order_date = fields.Date(string="Order Date", required=True, default=datetime.today())
    name = fields.Char(string="Description")
    customer_id = fields.Many2one('res.partner', string="Customer",
                              domain="[['category_id.name','ilike','customer']]", 
                                required=True)
     status = fields.Selection([
        ('pending', 'Pending'),
        ('incomplete', 'InComplete'),
        ('complete', 'Complete')
    ], required=True, string="Order Status", default='pending')
    rider_id = fields.Many2one('res.partner', string="Rider",
                               domain="[('category_id.name','ilike','rider'),
                                ('zone_id','=',customer_id.zone_id)]", required=True)

regards

0
Imagine profil
Abandonează
Imagine profil
Karan BK
Cel mai bun răspuns

I think you're getting this error because you're using zone_id which is the field in the customer_id which is in res.partner table not tests.testsorders.
Adding a onchange on customer_id will solve the issue.

@api.onchange("customer_id")
def _onchange_customer_id(self):
res = {
'domain': {
'rider_id': [('zone_id', '=', self.customer_id.zone_id.id)]
}
}
return res


I hope this works for you.

Karan BK

Junior Odoo Developer

Tel: +353 1 886 5684 (IE) +44 121 285 5684 (UK)  +91 964 381 7554 (IN)

Target Integration | CRM • ERP • Cloud

Website | LinkedIn | Twitter | Facebook | YouTube | Instagram

0
Imagine profil
Abandonează
SmithJohn45
Autor

thanks @Karan BK for help, but my domain filter contains 2 filters, first is ('category_id.name','ilike','rider') , can i use it as is with what you have mentioned or something to modify? i knew it is very very basic but i am from Oracle, python framework is very new for me, various things i still failed to understand.

SmithJohn45
Autor

also this change not worked as it is showing all entries from res.partner ( not from same Zone as Customer's )

SmithJohn45
Autor

sorry, it works... my fault spelling mistake :)

SmithJohn45
Autor

all done now... thanks again for your help :)

👈️ Rks

In odoo 14 ,domain on onchange is deprecated.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Hide some possible choices in a Many2one field
many2one v14
Imagine profil
Imagine profil
Imagine profil
2
apr. 23
3570
Odoo 14: How i can set Domain filter on Many2one type field Rezolvat
many2one v14
Imagine profil
Imagine profil
Imagine profil
2
feb. 25
41884
hide many2one record when changing condition
many2one v14
Imagine profil
Imagine profil
Imagine profil
2
nov. 22
3519
Odoo 14: set filter of Many2one field onchange of another Many2one field
many2one v14
Imagine profil
Imagine profil
1
feb. 22
8505
Many2one field is not showing record name on Saving form Rezolvat
many2one v14
Imagine profil
Imagine profil
2
dec. 21
4937
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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