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

Domain in xml odoo 10

Abonare

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

Această întrebare a fost marcată
python2.7odoo
2 Răspunsuri
7210 Vizualizări
Imagine profil
Kévin Hennion

I want use a domain filter in my xml field like this :

domain="[('id','>=',field)]"

However, i don't understand how does it work !

Here my fields :

    responsible_partner = fields.Many2one(string="Responsible",
                                          comodel_name="res.partner",
                                          ondelete='restrict',
                                          domain="[('company_type','=','person')]",
                                          delegate=False)
    responsible_foyer = fields.Many2one(string="Foyer responsible", comodel_name="horanet.relation.foyer", copy=False)

Here my form view XML :

   <field name="responsible_partner" required="True" domain="[('id','=',responsible_foyer.partner_id)]" />
   <field name="responsible_foyer" />

Here my function :

@api.onchange('partner_id')
def _get_active_foyer(self):
    if self.partner_id:
        actually_partner_id = self.partner_id.name
        if actually_partner_id:
            records_foyer_id = self.env['horanet.relation.foyer'].search([('partner_id', '=', actually_partner_id)])

            for rec_foyer in records_foyer_id:
                if rec_foyer.foyer_id:
                    records_partner_id = self.env['horanet.relation.foyer'].search(
                        [('foyer_id', '=', rec_foyer.foyer_id.id)])
                    for rec_partner in records_partner_id:
                        if rec_partner.partner_id:
                            self.responsible_partner = rec_partner.partner_id.id
                            self.responsible_foyer = rec_partner.id

Error :

Error: AttributeError: object has no attribute 'partner_id'

However, I have the field partner_id in my model : "horanet.relation.foyer".

Can you explain to me ?

Thanks

0
Imagine profil
Abandonează
Imagine profil
Kévin Hennion
Autor Cel mai bun răspuns

Hello,

Sorry for my english, I am french.

My function and my fields it's in 'ecole.partner.school' model. I have a 'partner_id' field in this model.

In my function, I don't have errors. What I get from the field 'responsible_foyer' is OK. However, I retrieve every partner if I click on my field Many2one in view XML. That is why, I want put a filter in XML. 

I an beginner on ODOO and there are maybe others ways to do :)

Thanks You

0
Imagine profil
Abandonează
Imagine profil
Tristán Mozos
Cel mai bun răspuns

Hiii!!!

I don't understand exactly what you want to do and I miss the description of the two models and the fields of these to can analyze better the error. However,  I have viewed something on your _get_active_foyer method. I assume that the method is of the model of your fields description. If it is true, I miss the partner_id field declaration on your model and can be a reason of error on self.partner_id statement on the first line.

Best regards

0
Imagine profil
Abandonează
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
how to do for many2one domain filter?
python2.7 odoo
Imagine profil
5
sept. 20
8442
How to add a list of product in a view?
python2.7 odoo
Imagine profil
Imagine profil
1
oct. 19
6585
how to customize one2many field in odoo
python2.7 odoo
Imagine profil
0
feb. 19
6469
How to modify “return ” to add a tax line in invoice
python2.7 odoo
Imagine profil
0
mai 18
3319
How to customize partner t-field-options in qweb reports Rezolvat
python2.7 odoo
Imagine profil
Imagine profil
1
apr. 24
26376
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