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
    • Textile
    • Kov
    • Nábytek
    • Jídlo
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • IT hardware a podpora
    • 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
    Browse all Industries
  • 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
    • Services for Partners
    • 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

fill in one2many field automatically when select many2many_tags

Odebírat

Get notified when there's activity on this post

This question has been flagged
treeviewone2manylistviewodoo11odoo11community
1 Odpovědět
9750 Zobrazení
Avatar
ai

I want to select configuration_template_ids which has also app_configuration_ids (configuration_template_ids. app_configuration_ids) and how can I pass all selected configuration_template_ids. app_configuration_ids into the field  <field name="app_configuration_ids" />

The list of app_configuration_ids should dynamically add all configuration_template_ids. app_configuration_ids or remove when deselect it.

<page string="App Configs"> 
        <field name="configuration_template_ids" string="Choose Template" widget="many2many_tags" options="{'no_create_edit': True}"  />

  <field name="app_configuration_ids" />

</page>



0
Avatar
Zrušit
Avatar
Khalid Hazam
Nejlepší odpověď

You need to define app_configuration_ids in your model as a computed field which will get the union of those configuration_template_ids. then you can display it in your view.

app_configuration_ids = fields.Many2many('<app_configuration_model>', compute='get_app_configurations')

@api.depends('configuration_template_ids')
@api.one
def get_app_configurations(self)
    self.app_configuration_ids = self.configuration_template_ids.mapped('app_configuration_ids')

0
Avatar
Zrušit
ai
Autor

thanks for your answer.

Unfortunately it does not work.

app_configuration_ids is one2many.

If I use compute I cannot edit app_configuration_ids anymore.

Khalid Hazam

Then you just need to remove the compute parameter and change the decorator to @api.onchange.

Though I'm not sure you will declare it as a one2many field. many2many seems for me the better option.

ai
Autor

app_configuration_ids = fields.One2many('ia.app.property', inverse_name='product_id', string='App Configs')

app_configuration_template_ids = fields.One2many('ia.app.configuration.template', store=False)

@api.onchange('app_configuration_template_ids')

def get_app_configurations(self): self.app_configuration_ids=self.app_configuration_template_ids.app_property_ids

I have change to onchange, but the method get_app_configurations will not trigger. Do u know why?

Khalid Hazam

It probably does trigger but since you have a One2many field you need to use the special syntax to update it:

self.write({'app_configuration_ids': [(6, 0, self.app_configuration_template_ids.app_property_ids.ids)]})

There is also a neat solution where you can instead declare the product_id as a related field in your 'ia.app.property' model:

product_id = fields.Many2one('product.product', related='app_configuration_template_id.product_id', store=True)

I haven't tried it but I think it will also work

ai
Autor

the problem is that I don't want to store it. just have the ids -> store= False

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
Sub header for tree view
views treeview one2many listview
Avatar
Avatar
1
zář 21
3751
How to change the list view color for dates in odoo ?
treeview listview odoo11 decoration
Avatar
Avatar
Avatar
Avatar
3
dub 21
6647
Odoo 11 Treeview Report
treeview odoo odoo11 odoo11community
Avatar
0
čvn 20
3490
STICK one2many tree view headers
javascript treeview one2many listview tree
Avatar
1
úno 24
1778
Odoo 11 One2many and many2many field understanding
one2many many2many OdooExperience odoo11 odoo11community
Avatar
Avatar
1
bře 19
4355
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