Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Call function from the "More" dropdown list

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
functionclickdrop_downbuttonobjectdropdownmoreir.values
12 Răspunsuri
33228 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
Maniganda
Cel mai bun răspuns

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
Imagine profil
Abandonează
Eric
Autor

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
Autor

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!!! :)

Imagine profil
Artem
Cel mai bun răspuns

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
Imagine profil
Abandonează
Imagine profil
Eric
Autor Cel mai bun răspuns

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
Imagine profil
Abandonează
Maniganda

Eric i have updated the answer you can check this

Eric
Autor

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.

Imagine profil
belazarFati
Cel mai bun răspuns

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

0
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
dropdown depends on other dropdown
drop_down dropdown
Imagine profil
Imagine profil
1
mai 21
3327
api request
function api button
Imagine profil
0
dec. 24
2224
How to open a wizard with yes or no buttons (Odoo 14) Rezolvat
function button Buttons
Imagine profil
Imagine profil
Imagine profil
2
sept. 22
10000
Button Functions Rezolvat
button object OdooV13
Imagine profil
Imagine profil
2
ian. 22
6018
[Odoo 10] Update view calling function from another model using button? Rezolvat
function button odoo10.0
Imagine profil
Imagine profil
4
mar. 19
10561
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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