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

server action: create record in v17: where to fill in the target model field values? (data to write)

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
createrecordserver_actionsAutomatedActionsv17
2 Replies
7314 Tampilan
Avatar
Roeland Vandecan

Hi all,

In v16.4 you could configure a server action/automated action to create a new record in another model

https://www.odoo.com/documentation/master/applications/productivity/studio/automated_actions.html#create-a-new-record

Within the automated action you could add data to write (you could add field data to be saved in the target model.)


In v17 i can't find that functionality anymore (the data to write) although it is still in the documentation.

How should we proceed? 

Should we select python code and do it via python code?

or is there another thing i should know ?


thx for sharing your info!


kr

roeland

2
Avatar
Buang
Chris TRINGHAM

Yes, the functionality has been lost in v17 as per this change in GitHub: https://github.com/odoo/odoo/pull/114352

You can create a record but you can't specify any fields. It's possible to do some of it in Python, but ironically this so-called simplification has made it more difficult.

https://www.odoo.com/forum/help-1/limitations-in-automation-rules-odoo-17-244783

Juris Aidma

a feature which encourages to learn Python or?

Moritz Haendel

The improvement introduced regressions. Models created with Studio are named x_name. When the action is trying to create that record, it tries to fill name, which does not exist. Thus, fails.

Chris TRINGHAM

Hi Moritz - I'm not sure this is a specific issue with models created with Studio. If you hardcode the name of the new record in the Automation Rules that will work whether it's a Studio model or not. The problem is how to set a value for each record, and the solution below does that if you write Python code (in which case you would need to set a value for x_name and any other mandatory fields on your new model)

Avatar
Roeland Vandecan
Penulis Jawaban Terbai

Hi all,


I think I have found the solution:

Create a server action with the type "Execute code".

Then use the following code:


 env['targetmodelname'].create({

         'field1':record.name,                          =>insert python expression

         'field2':25,                                          =>insert value (integer, float)

         'field3':record.id                                =>insert python expression (linked field)

​'field4':"characters"                          =>insert value (char)

 })

 

env['targetmodelname'].create({
         'field1':record.name,
         'field2':25,
         'field3':record.id,
	 'field4':"characters"
 })
1
Avatar
Buang
Chris TRINGHAM

Indeed, this is possible, but so-called "simplification" has made it more difficult.

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Jawaban Terbai

Hi,

In odoo17 you can create another record by using the automation rule by following the below steps

1)Open the Automation rule from settings ->Technical ->Automation -> Automation Rule


2) Create a new record by adding the fields


You can change the field values according to your needs

3) click on the Add an Action button from the Action To Do page Then a pop-up will appear. from that select Create Record option


Then you can fill in the values in the action details area.


Hope it helps


-2
Avatar
Buang
Chris TRINGHAM

You can create a record, but you cannot set any fields in the target model (as per my earlier comment)

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
Webhooks. How do I create a new record? Diselesaikan
create record new webhook v17
Avatar
Avatar
2
Agu 25
5908
Limitations in Automation Rules (Odoo 17) Diselesaikan
AutomatedActions Automation v17
Avatar
Avatar
Avatar
2
Apr 25
5823
Odoo 17: Alternative to deprecated "On Creation" for automated actions? Diselesaikan
Studio AutomatedActions v17
Avatar
Avatar
Avatar
2
Jan 25
5249
How to use server action to make a POST request to an Angular server Diselesaikan
server_actions v13 AutomatedActions
Avatar
Avatar
Avatar
2
Okt 24
3994
[Odoo 17] Validate as Backorder Diselesaikan
backorder server_actions v17
Avatar
Avatar
2
Apr 24
3176
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