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

How to retrive values in Many2one field as selection field?

Abonare

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

Această întrebare a fost marcată
pythonmany2oneselectiononchangeodoo
2 Răspunsuri
17140 Vizualizări
Imagine profil
Mostafa Mohamed Abdel Monaem

How to retrieve values on Many2one field using OnChange ?

When i try to do so it gives me an error

'Expected singleton: fci.standard.groups(3, 4, 5, 6)'

I'm trying that when i change the standard field the group field will be updated to select only groups in this standard

Here is my fields

'standard_id': fields.many2one('fci.standard', string='Standard', required=True),

'group_id': fields.many2one('fci.standard.groups', string='Standard Group'),

Here is my function

def on_change_standard(self, cr, uid, ids, standard_id, context=None):

val = {}

if not standard_id:

return {}

student_obj = self.pool.get('fci.standard')

student_data = student_obj.browse(cr, uid, standard_id, context=context)

val.update({'group_id': student_data.groups_ids.id})

return {'value': val}

and here is my xml

<field name="standard_id" on_change="on_change_standard(standard_id)" widget="selection"/>

<field name="group_id" widget="selection"/>

0
Imagine profil
Abandonează
Cyril Gaspard (GEM)

hi, you try to set a list of id in a many2one field which requires just one id, this not possible, you should have same type of field for group_id than groups_ids, if you want that values for group will be always the same in 2 class, use a field function type with type of groups_ids. bye

Imagine profil
Baiju KS
Cel mai bun răspuns

Hi,

You can't pass more than one 'id' to a many2one field, that’s why you are getting error.

Its seems like you need domain filter , Please Check this :- (and add a proper filter for this field :   <field name="group_id" widget="selection"/>    )


Simple condition in programming:

if field1 = 10

In OpenERP domain filter, it will be written as:

syntax : Each tuple in the domain has three fields -> (‘field_name’, ‘operator’, value)

field_name : a valid name of field of the object model or in the database table

operator : valid operators are =, !=, >, >=, <, <=, like, ilike, in, not in, child_of, parent_left, parent_right (openerp/osv/expression.py)

value : a valid value to compare with the values of field_name, depending on its type.

ie, domain = [(‘field1′,’=’,10)] # where field1 should be a field in the model and 10 will be the value

or domain = [(‘field1′,’=’,field2)] # where field1 and field2 should be the fields in the model

Condition AND

Simple condition in programming:

if field1 = 5 and field2 = 10

In OpenERP domain filter, it will be written as:

ie, domain = [(‘field1′,’=’,5),(‘field2′,’=’,10)]

or domain = [(‘field1′,’=’,field3),(‘field1′,’=’,field3)]

Note : Note that if you don’t specify any condition at the beginning and condition will be applied.

Condition OR

Simple condition in programming:

if field1 = 5 or field2 = 10

In OpenERP domain filter, it will be written as:

ie, domain = [‘|’, (‘field1′,’=’,5),(‘field2′,’=’,10)]

or domain = [‘|’, (‘field1′,’=’,field3),(‘field1′,’=’,field3)]

Multiple Condition

Simple condition in programming:

if field1 = 5 or (field2 ! = 10 and field3 = 12)

In OpenERP domain filter, it will be written as:

domain = [‘|’,(‘field1′,’=’,5),(‘&’,(‘field2′,’!=’,10),(‘field3′,’=’,’12’))]


Hope this helps........

1
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 Use Many2one Field as selection for details?
many2one selection onchange
Imagine profil
Imagine profil
1
iul. 19
7790
Filtering Many2one data based on selected status
filter many2one selection onchange
Imagine profil
Imagine profil
1
aug. 23
2563
bug sort selection field in one2many(notebook) view
many2one selection sort notebook odoo
Imagine profil
Imagine profil
1
iun. 24
1987
How can I create a selection of companies ? Rezolvat
many2one selection res.company odoo v15
Imagine profil
Imagine profil
Imagine profil
2
nov. 22
4024
Can't change custom field value that is on another model
python many2one account.move onchange account.move.line
Imagine profil
Imagine profil
1
apr. 22
4149
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