Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

many2many automaticly filled

Odebírat

Get notified when there's activity on this post

This question has been flagged
wizardmany2many
1 Odpovědět
14151 Zobrazení
Avatar
Francisco Castro

Hi guys Help me I want to fill the many2many filled automaticly withou have to click on the add button

image description

I want fo fill the mannu "Lista de Pets" with the records on the "pets" when I click on the "Lista de Pets"

It is possible?

Show me an example please

0
Avatar
Zrušit
Avatar
René Schuster
Nejlepší odpověď

If you just want to view a list of all the pets, I recommend a wizard (osv.osv_memory).

Anyway, wizard or not:
Add a default value for your many2many field and use a function to get all pets.

_columns = {
    'pet_ids' = fields.many2many(.....),
}

def _get_default_pet_ids(self, cr, uid, context=None):
    return self.pool.get('your_pet_module').search(cr, uid, [])

_defaults = {
    'pet_ids' = _get_default_pet_ids,
}

That's it.

EDIT:

The standard way to filter your data is using a search view.
But if you want to use a selection field do something like this:

def onchange_onwer_id(self, cr, uid, ids, val):
    ids = self.pool.get('your_pet_module').search(cr, uid, [('owner_id','=',val)])
    return {'value' : {'pet_ids' : ids}} 

_columns = {
    'pet_ids' = fields.many2many(.....),
    'owner_id' = fields.many2one(.......),
}

and in your .xml:

<field name="owner_id" on_change="onchange_owner_id(owner_id)"/>
6
Avatar
Zrušit
Francisco Castro
Autor

thank you very much man. And if I want to put a selection filed to filter the records how can I do it?

Francisco Castro
Autor

I have the 'owner_id' many2one filed I want to filter the pets by owner

Francisco Castro
Autor

another question if u could help me... I want to put checkbox into the rows and when it are check load buttons to delete the records from the database. like in tree view when you check the checkbox, pops up a button and we can delete the records. I want the same and with the same button if its possible

René Schuster

I guess I don't know the answer to this question. Try removing the widget on your many to many field, or something. ^^

Francisco Castro
Autor

ok thanks a lot you helped very much :)

Francisco Castro
Autor

If I want to remove the 2 first rows on the many2many field by clicking on a button ("Remove") wich function I have to do? (btw you have to put here your email or skype eheh I have some questions and you help a lot)

Francisco Castro
Autor

could you help me in another problem? hehe pls go to my question "many2many button action" if you know it pls explain me :)

Yenthe Van Ginneken (Mainframe Monkey)

Great sample :) It missed a : at the function so I corrected that. Thanks René

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

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
How to transfer id created wizard into main form?
wizard many2many
Avatar
Avatar
1
čvc 18
3992
Many2many field in wizard is showing empty (v9) ?
wizard many2many
Avatar
0
led 16
4123
Is it possible to use many2many relation for other many2many field in wizard
wizard many2many
Avatar
Avatar
1
bře 15
5354
many2many in custom wizard
wizard many2many
Avatar
0
bře 15
7972
Upon pressing save in a wizard, populate a many2many field
wizard many2many v15
Avatar
0
čvc 22
2980
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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