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
    • 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

Call function from the "More" dropdown list

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
functionclickdrop_downbuttonobjectdropdownmoreir.values
12 Replies
33257 Tampilan
Avatar
Eric

Hello.  I was wondering how can you run a function when you click on an option from the "More" menu dropdown in a Tree view.

For example:  When you are looking at all the records in a Tree view, then you click the check box for each record, then the "More" button appears at the top and if you select "Delete" then it calls the unlink method for that model and deletes the selected records.

I figured out how to add another item in the "More" dropdown, but I don't know how to run a function when the item is clicked.  All it does right now is open another form view, but I would like it to process some information before displaying it in another form. Here is an example of what I have

 

<record id="hr_employee_normal_action_tree2" model="ir.actions.act_window">
            <field name="name">Erics More Item</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">hr.employee</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>

        <record model="ir.values" id="test_more_item">
            <field name="name">Test Item</field>
            <field name="model" eval="'sale.order'" />
            <field name="key" >action</field>
            <field name="key2">client_action_multi</field>
            <field name="value" eval="'ir.actions.act_window,%d'%hr_employee_normal_action_tree2" />
            <field name="object" eval="True" />
        </record>

 

So does anyone know how to run a function when the item from the "More" dropdown is selected?  I guess what I kind of need is the functionality which is similar to a button that is an object type.  So when a button is clicked then it runs a function on that model. 

5
Avatar
Buang
Avatar
Maniganda
Jawaban Terbai

Hi Eric you can achieve this by addind few lines of code in your server action

<record id="sale_license_more_item_action" model="ir.actions.server">

             <field name="name">Erics More Item</field>

            <field name="model_id" ref="model_sale_licenses"/>
            <field name="state">code</field>
            <field name="code">action = self.renew_license(cr, uid, context.get('active_ids', []), context=context)</field>
        </record>
        
        <record id="test_more_item" model="ir.values">
            <field eval="'client_action_multi'" name="key2"/>
            <field eval="'sale.licenses'" name="model"/>
            <field name="name">Test Item</field>
            <field eval="'ir.actions.server,%d'%sale_license_more_item_action" name="value"/>
        </record>

 

15
Avatar
Buang
Eric
Penulis

Hello Maniganda. Thank you for your help. I did what you said, but it still isn't working for me. Let me show you what I have again and can you let me know if you see anything wrong with it. Thank you again Erics More Item ir.actions.act_window sale.licenses form form self.renew_license(cr, uid, context.get('active_ids', []), context=context) Test Item action client_action_multi

Eric
Penulis

the last comment got cut off. I'll post my code as another answer so that you can see

abdallah ghrir

i want to call function :'action_button_confirm' in dropdown list menu "More" ???? this is my code and it dosent work : Transformer en BL ir.actions.act_window sale.order form form self.action_button_confirm(cr, uid, context.get('active_ids', []), context=context) Test Item action client_action_multi

dirtyHandsPHP

Thanks @Maniganda: You saved my day!!! :)

Avatar
Artem
Jawaban Terbai

working code

<record id="dditem1_action" model="ir.actions.server">
        <field name="name">Text to display as menu item</field>
        <field name="model_id" ref="model_your_model"/>
        <field name="state">code</field>
        <field name="condition">True</field>
        <field name="code">if object: self.browse(cr,uid,context.get('active_ids', [])).your_function()</field>
</record>
<record id="dditem1" model="ir.values">
        <field name="name">name</field>
        <field name="model">your.model</field>
        <field name="key" >action</field>
        <field name="key2">client_action_multi</field>
        <field name="value" eval="'ir.actions.server,%d'%dditem1_action"/>
</record>
@api.multi
def your_function(self):
     for item in self:
         # do something with selected records
1
Avatar
Buang
Avatar
Eric
Penulis Jawaban Terbai

My new code:

<record id="sale_license_more_item_action" model="ir.actions.act_window">
            <field name="name">Erics More Item</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.licenses</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="code">self.renew_license(cr, uid, context.get('active_ids', []), context=context)</field>
        </record>

        <record model="ir.values" id="test_more_item">
            <field name="name">Test Item</field>
            <field name="model" eval="'sale.licenses'" />
            <field name="key" >action</field>
            <field name="key2">client_action_multi</field>
            <field name="value" eval="'ir.actions.act_window,%d'%sale_license_more_item_action" />
            <field name="object" eval="True" />
        </record>

 

I dont get any errors, but it still just goes to the form without running the code that was added.  Thank you again

1
Avatar
Buang
Maniganda

Eric i have updated the answer you can check this

Eric
Penulis

Thank you Maniganda for your help. Your solution works for me. Can you help me with one more thing? The function that is called is supposed to create a new sales order, which it does, but I would also like it to open the new sales order form when its finished. The end of my function returns a dictionary like this return { 'name': 'Sales Order', 'view_type': 'form', 'view_mode': 'form', 'view_id': self.pool.get('ir.ui.view').search(cr, uid, [('name','=','sale.order.form')])[0], 'res_model': 'sale.order', 'res_id': new_order_id, 'type': 'ir.actions.act_window', } This seems to work on other function calls, but for some reason it isn't working for this one.

Maniganda

Eric i have updated the answer

OdooBot
Hello Maniganda.  I appreciate your help.  I'm still having trouble with opening the new sale order in the form view once my function is done executing.  Do you have any other ideas?


On Tue, Sep 2, 2014 at 10:59 PM, Maniganda <k-maniganda-gmail-com@mail.odoo.com> wrote:

Eric i have updated the answer

--

Maniganda
Sent by OpenERP S.A. using Odoo about Forum Post False



--
Eric Bangerter | tel.: +1 (954) 585-9016 xYourExtension
Mertech Data Systems, Inc. | 114 East Shaw Avenue | Suite 209 | Fresno, CA 93710 | USA | Fax: +1 (866) 228-1213 | www.mertechdata.com
Building Bridges to New Technologies

CONFIDENTIALITY NOTICE
This email message from Mertech Data Systems, Inc. is intended only for the individual or entity to which it is addressed. This email may contain information that is privileged, confidential and exempt from disclosure under applicable law. This email may contain information which is shared in confidence with the recipient and must not be shared on any social media or posted on forums, blogs and websites without written consent from Mertech Data Systems, Inc. If you received this e-mail by accident, please notify the sender immediately and remove it from your system. You are hereby notified that unauthorized dissemination, distribution or copying of this communication is prohibited.

CONFIDENTIALITY NOTICE

This email message from Mertech Data Systems, Inc. is intended only for the individual or entity to which it is addressed. This email may contain information that is privileged, confidential and exempt from disclosure under applicable law. This email may contain information which is shared in confidence with the recipient and must not be shared on any social media or posted on forums, blogs and websites without written consent from Mertech Data Systems, Inc. If you received this e-mail by accident, please notify the sender immediately and remove it from your system. You are hereby notified that unauthorized dissemination, distribution or copying of this communication is prohibited.

Avatar
belazarFati
Jawaban Terbai

can you please tell me what is  eval="'ir.actions.act_window,%d'%hr_employee_normal_action_tree2"  stand for

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
dropdown depends on other dropdown
drop_down dropdown
Avatar
Avatar
1
Mei 21
3345
api request
function api button
Avatar
0
Des 24
2232
How to open a wizard with yes or no buttons (Odoo 14) Diselesaikan
function button Buttons
Avatar
Avatar
Avatar
2
Sep 22
10016
Button Functions Diselesaikan
button object OdooV13
Avatar
Avatar
2
Jan 22
6023
[Odoo 10] Update view calling function from another model using button? Diselesaikan
function button odoo10.0
Avatar
Avatar
4
Mar 19
10573
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