Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • E-learning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Artificial Intelligence
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Horeca & Hospitality
    • Bar en café
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van mede-eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brouwerij
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Diensten
    • Klusjesman
    • IT-hardware & ondersteuning
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Alle bedrijfstakken bekijken
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijsprogramma
    • Scale Up! Business Game
    • Odoo bezoeken
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Partner worden
    • Diensten voor partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Create python filter domain dinamically odoo14

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
v14
2 Antwoorden
1320 Weergaven
Avatar
sfs, jonathankabre1@gmail.com

Hi, 
i want to fetch my table account.move.line depending on the value provided from the form.

so normally I have to do this:

"

domains = [(' partner_id ', '=', 'self.partener_id.id'), (' account_id ', '=', 'self.account_id.id'),]

 moves = self.env['account.move.line'].search(domains)

"

But now, having two (02) parameter in domain is not required, so i can have 0, or 1, 0r 2 parameter depending if i filled the imput form   partener_id and  account_id 


so this is what i tried:

"

 if rec. partner_id  .id != False:                

    domains += "('partner_id', '=', '" + str(rec. partner_id  .id) + "'),"           

 if rec. account_id .id != False:                

     domains   += "('account_id', '=', '" + str(rec. account_id .id) + "'),"                                         


moves = self.env['account.move.line'].search([domains])

"

but this return the following error: 

ValueError: Invalid leaf ('partner_id', '=', '8'),('account_id', '=', '2'),


How can i fix it?

 

0
Avatar
Annuleer
Niyas Raphy (Walnut Software Solutions)

make sure that the fields are in the corresponding models.
also you can refer this: https://www.youtube.com/watch?v=dq5Vtj_pwuI

sfs, jonathankabre1@gmail.com
Auteur
hi, my post displays: 

500: Internal Server Error

can you see what happened?

Le jeu. 30 déc. 2021 à 15:17, Léo Auvray <lau@2crsi.com> a écrit :

Une nouvelle question Create python filter domain dinamically odoo14 le Aide a été publiée. Cliquez ici pour accéder à la question :

Voir la question

Envoyé par Odoo S.A. utilisant Odoo.

Avatar
Jainesh Shah(Aktiv Software)
Beste antwoord

This error is because you are concating the string and use it as domain,
As domains are must be a list of tuples or list of list

So you can make your domain like this.

domains = []

if rec.partner_id.id != False:
domains += [('partner_id', '=', rec.partner_id.id)]

if rec.account_id.id != False:
domains += [('account_id', '=', rec.account_id.id)]


Create python filter domain dinamically odoo14
https://www.odoo.com

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

0
Avatar
Annuleer
Avatar
sfs, jonathankabre1@gmail.com
Auteur Beste antwoord

thanks but this not answer to my question.

the user have 2 field to filled: parameter_id and account_id.
if he field none of the 2 fields, my script 'ld look like :   moves = self.env['account.move.line'].search([])

if he field  parameter_id  only ->  moves = self.env['account.move.line'].search([ (' partner_id ', '=', 'self.partener_id.id') ])

if he field   account_id only ->  moves = self.env['account.move.line'].search([(' account_id ', '=', 'self.account_id.id')]) 

if he field  parameter_id and  account_id  ->  moves = self.env['account.move.line'].search([ (' account_id ', '=', 'self.account_id.id') ,(' account_id ', '=', 'self.account_id.id') ])


and then i use   'moves' for others treatements   

0
Avatar
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
How to create Approval - V14
v14
Avatar
1
apr. 26
1603
Attached PDF file is not formatted properly
v14
Avatar
Avatar
1
dec. 25
1535
Odoo14 alternative for Automated Translations through Gengo API module
v14
Avatar
Avatar
Avatar
Avatar
3
sep. 25
4681
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Avatar
0
aug. 25
1983
How to Managing Birthdate and Age in Odoo
v14
Avatar
Avatar
1
aug. 25
4543
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Partner worden
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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