Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Artificial Intelligence
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Manajemen Properti
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Tanya ahli
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Create python filter domain dinamically odoo14

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
v14
2 Replies
1326 Tampilan
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
Buang
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
Penulis
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)
Jawaban Terbai

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
Buang
Avatar
sfs, jonathankabre1@gmail.com
Penulis Jawaban Terbai

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
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
How to create Approval - V14
v14
Avatar
1
Apr 26
1661
Attached PDF file is not formatted properly
v14
Avatar
Avatar
1
Des 25
1573
Odoo14 alternative for Automated Translations through Gengo API module
v14
Avatar
Avatar
Avatar
Avatar
3
Sep 25
4706
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Avatar
0
Agu 25
2012
How to Managing Birthdate and Age in Odoo
v14
Avatar
Avatar
1
Agu 25
4576
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Karir
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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