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í
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • 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

One2many field domain not working

Odebírat

Get notified when there's activity on this post

This question has been flagged
domainfieldsOdoo13.0
2 Odpovědi
6972 Zobrazení
Avatar
Fernanda P

Hello, Im trying to set a domain for my One2many field but its not working, it still showing values out of the condition I set in my domain. In my view I have two one2many fields, 1 who is supposed to show the account with the internal_type = payable and other with the value = receivable, but, when I select 1 account from 1 of the one2many fields for example one of the value as payable, it also set that account to my other one2many field who is supposed to only show the "receivable" accounts. 

I also tried to set the domain in the xml but still not working. (for some reason the code of the xml here disappear)

My code: 

class PartnerElectronic(models.Model): _inherit = "res.partner"
    payable_partner_accounting_entries = fields.One2many('ak.partner.accounting.entries', 'partner_id', string='Payable', domain="[('
account_type','='payable')]")
receivable_partner_accounting_entries = fields.One2many('ak.partner.accounting.entries', 'partner_id', string='Receivable', domain="[('account_type','=','receivable')]")

class PartnerPayableAccountingEntries(models.Model):
    _description = 'Partner Accounting Entries'
    _name = 'ak.partner.accounting.entries'

    partner_id = fields.Many2one('res.partner', 'Partner')
    account_id = fields.Many2one('account.account', string='Account')
    account_type = fields.Selection(related='account_id.internal_type', store = True)
    _sql_constraints = [('account_unique','UNIQUE(account_id)',"Partner Account must be unique")]

XML:

    
    
    
        



    
    
    
        





0
Avatar
Zrušit
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Nejlepší odpověď

Hi,

The two one2many fields are using the same inverse Many2one field (partner_id) in the co-model. Try with different inverse Many2one field for each of the one2many field.

Regards.

1
Avatar
Zrušit
Avatar
Fernanda P
Autor Nejlepší odpověď

I already found the correct answer to achieve what I need

payable_partner_accounting_entries = fields.One2many('ak.partner.accounting.entries', 'partner_id', string='Payable', domain=lambda self: [('account_id.internal_type', '=', 'payable')])    

receivable_partner_accounting_entries = fields.One2many('ak.partner.accounting.entries', 'partner_id', string='Receivable', domain=lambda self: [('account_id.internal_type', '=', 'receivable')])
0
Avatar
Zrušit
Răzvan Anastasescu

You don't need to put the domains in lambda functions, you can simply pass the domain value as:

domain=[('account_id.internal_type', '=', 'receivable')]

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
get fields value based on domain
domain Odoo13.0
Avatar
Avatar
1
říj 20
4021
How to implement dynamic domain conditional field?
domain fields conditional
Avatar
Avatar
Avatar
Avatar
3
kvě 24
7156
How to get field information from product page?
code fields Odoo13.0
Avatar
0
pro 21
3787
Updating One2many field inside onchange breaks the field
fields one2many Odoo13.0
Avatar
Avatar
1
kvě 21
5492
display list of product based on domain Vyřešeno
domain domain_filter Odoo13.0
Avatar
Avatar
Avatar
6
srp 20
8385
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