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

Dynamic formula in user friendly manner ?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
technicalodoov14
2 Replies
3603 Tampilan
Avatar
Saif Kazi

Greetings, I am familiar with the ability to create custom functions within a model in Odoo, however, I am inquiring if there is a user-friendly method for adding dynamic formulas directly from the form, such as inputting a short Python code that contains formula logic and executing it within the form. Has anyone had experience or knowledge of a solution for this within the Odoo platform? Any suggestions would be highly appreciated.

0
Avatar
Buang
Avatar
S.M Firoz Ahmed ( Daffodil Software Limited )
Jawaban Terbai

It is possible to add dynamic formulas directly from the form in Odoo by using the "Computed Fields" feature. Computed Fields allow you to define a custom function that will be called when certain fields in the form are changed, and the result of that function will be stored in a specific field in the model.

You can create a computed field by going to the developer mode in Odoo and navigate to the desired model and fields. In the fields you can create a new field and select "computed" as the type. Then you will have to write a python function that will be called when the field is computed, this function can make use of other fields in the form to calculate the final value.

Alternatively, you can also use the "onchange" method on fields, this method is called when the value of the field is changed by the user, you can use this method to update other fields with the new value.

It's worth mentioning that both solutions require knowledge of python programming, and it's recommended to test the code before implementing it on the live system.

0
Avatar
Buang
Saif Kazi
Penulis

Hey
thanks a lot for the reply .. actually I already tried this . but I had a one2many field . And the calculation is dependent on other records and not the same record

Avatar
MUHAMMAD Imran
Jawaban Terbai

In Odoo, it is possible to create dynamic formulas and calculations directly from the form using the compute attribute. The compute attribute allows you to specify a method that will be called when the field's value is needed. This method can contain any logic or calculations you need to perform, including the use of Python code.


The method should be decorated with @api.depends and should have the same name as the field that you want to calculate. The depends attribute should contain a list of fields that are used in the calculation.


Here is an example of how you might use the compute attribute to create a dynamic formula in an Odoo model:


python

Copy code

class MyModel(models.Model):

    _name = 'my.model'


    x = fields.Integer()

    y = fields.Integer()

    result = fields.Integer(compute='_compute_result')


    @api.depends('x', 'y')

    def _compute_result(self):

        for record in self:

            record.result = record.x + record.y

In this example, the result field is calculated by adding the values of the x and y fields, and the calculation is performed whenever one of those fields changes.


It's worth noting that you can also use compute attribute with the function fields, and you can use them in the form view and in the tree view, it also could be used in the search view.


Keep in mind that the method decorated with @api.depends should be on the same model that the fields it depends on, otherwise, it will not work as expected

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 hide odoo from Wappalyzer
technical odoo
Avatar
Avatar
1
Mei 24
3161
Odoo - Add a dynamic <filter domain="xxxxx"
odoo v14
Avatar
Avatar
1
Mei 24
4061
Add files in the website form
technical odoo
Avatar
Avatar
Avatar
2
Jun 23
3542
How to use a custom domain with Odoo v14?
odoo v14
Avatar
Avatar
1
Apr 24
28603
auto filled record field in another page when create new record
odoo v14
Avatar
Avatar
1
Nov 22
3370
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