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
    • Diskusi
    • Approval
    • 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
    • Estate Management
    • 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
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
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

Smart search of phone numbers.

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
search12.0
2 Replies
5684 Tampilan
Avatar
Lucas John

Hello everyone!

I have phone numbers in contacts written in different forms, with whitespaces, without, in group of 2 - 3 digits.

How to search in those all forms entering number in search form as one continous string of digits?

Let's say writing in search form - 123456789 i want to get results with phone numbers:

123456789

123 456 789

12 34 56 789

+33 12 34 56 789

etc.

The solution (stupid?) is to add wildcard "%" between each letter in search form - %1%2%3%4%5%6%7%8%9%

But maybe there is another - better solution? :)


0
Avatar
Buang
Jack Dane

Hello Lucas,

Would you prefer to keep the spaces in the numbers? As I have a solution which will remove all spaces, meaning that you wouldn't need the wildcard.

Thanks,

Avatar
Jack Dane
Jawaban Terbai

Yes "stupid proof" is what I specialise in! 

The best way would be to create either an automated action or a onchange event depending on your knowledge of creating Odoo apps you can do an onchange event which will remove all spaces from numbers as soon as they click off the field eg:

(requires creating an external app)

    @api.onchange("phone")
    def remove_spaces_from_phone_number(self):
        for record in self:
            if record.phone:
                record.phone = record.phone.replace(" ", "")

(do the same for mobile)

Or create an automated action in Settings->Tehnical->Automated Action. You would set the fields as Model->Contact, Action To Do->Execute Python Code and put "phone, mobile" in the On Change Fields Trigger. (Also make sure the module "base_automation" is installed. 

(can all be done within Odoo GUI)

The Python code would be: 

if record.phone:
  record["phone"] = record.phone.replace(" ", "")
if record.mobile:
  record["mobile"] = record.mobile.replace(" ", "")

For already existing phone numbers you can then write a scheduled action which would be:

all_contacts = env["res.partner"].search(["|", ("phone", "!=", False), ("mobile", "!=", False)])
for contact in all_contacts:
  if contact.phone:
    contact["phone"] = contact.phone.replace(" ", "")
  if contact.mobile:
    contact["mobile"] = contact.mobile.replace(" ", "")

You can run this once and it should be ok as users can no longer add spaces to numbers, or have this running once a day just incase.

I hope this helps!

1
Avatar
Buang
Lucas John
Penulis

Jack, I chose the solution from the GUI.

I installed base_automation, but I cannot see plase to put triggers - phone, mobile. Where it should be?

Maybe it's needed to somehow restart engine after installing base_automation?

Lucas John
Penulis

UPDATE. I somehow open "Planned Actions" instead of "Automated Action". It looks, that i have no more spaces in phone numbers so... IT WORKS!

Please PM me you address I will send you big beer :)

Jack Dane

Hello Lucas,

When you select Action To Do->Execute Python Code it should be below the field "Apply On".

Thanks,

Avatar
Lucas John
Penulis Jawaban Terbai

Hello Jack,

it depends, i cannot assume that all ODOO users will hold on new rule with entering phone number, does your solution will replace all existing numbers with space-less ones, and eventually remove spaces in number entered in future? In short, is it "stupid proof"? :)

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 do I filter a spreadsheet pivot to the current/previous month
search
Avatar
Avatar
1
Jul 25
1441
Search a message Diselesaikan
search
Avatar
Avatar
1
Feb 25
1812
How To Set Char Type Field Only Have Number Input ODOO 12 ?
12.0
Avatar
2
Jan 25
7569
computed fields Diselesaikan
12.0
Avatar
Avatar
1
Apr 24
3561
running odoo 12 on ubuntu 22.04 OS, python 3.7, postgresql 15.0
12.0
Avatar
Avatar
1
Des 23
6328
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
  • Tugas
  • 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 ภาษาไทย 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