Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

How to add an option to the "action" drop-down menu in tree view?

Naroči se

Get notified when there's activity on this post

This question has been flagged
actiontree_viewodoov11
1 Odgovori
27641 Prikazi
Avatar
Daniele Morelli

I am using Odoo v.11 EE.

I'm following the "create a module" tutorial on the official docs (https://www.odoo.com/documentation/11.0/howtos/backend.html), so I made a 'course' module and a 'session' module etc, with no great issues.

If i go to the tree view for courses, and check some entries, an "Action" menu appears with a number of options (in this case, "Export" and "Delete"). I'd like to add a new option and bind it to some backend logic to be executed on the selected elements.

I found some hints online (e.g: https://stackoverflow.com/questions/36285497/how-to-add-entry-to-more-menu-or-top-menu-to-add-action-on-multiple-selections), but it doesn't seem to be working on odoo11.

Is there a standard way to accomplish that?

EDIT:

For now I managed to insert a button like the following

<button name="mymethod" string="My Method" type="object" class="oe_highlight"/> 

and I binded it to a simple @api.multi method in the model:

    @api.multi
def mymethod(self):
print("TEST")
return True

This works (i.e. when the button is clicked i see the "TEST" string in the console), but still I need to understand how to bind the method to an option in the "Action" drop-down (not to a button).

I managed to do a window action linked to an option in the "Action" drop-down (If i'm not wrong this is accomplished by setting the key2 field as "client_action_multi"), but what I need is a server action, so, by analogy, I tried to define it as follows:

<record model="ir.actions.server" id="act_new_sub_menu_lol">
<field name="name">CANT MAKE THIS WORK</field>
<field name="model_id" ref="model_openacademy_course"></field>
<field name="src_model">openacademy.course</field>
<field name="key2">client_action_multi</field>
<field name="view_mode">tree</field>
<field name="target">new</field>
<field name="view_type">tree</field>
</record>

But no option appears in the drop-down.


Thank you in advance for any help.

0
Avatar
Opusti
Niyas Raphy (Walnut Software Solutions)

See this: https://www.youtube.com/watch?v=yGKYPtAeP7k

Avatar
subbarao
Best Answer

<act_window id="action_set_invoice_done"

            name="Your menu name"

            src_model="menu will display on this model"

            res_model="wizard model"

            view_type="form" view_mode="form"

            key2="client_action_multi" target="new"

/>


Example: Under Invoice tree i added set done menu

<act_window id="action_set_invoice_done"

            name="Set Done"

            src_model="account.invoice"

            res_model="set.invoice.done"

            view_type="form" view_mode="form"

            key2="client_action_multi" target="new"

            groups="account.group_account_manager"/>

1
Avatar
Opusti
Daniele Morelli
Avtor

Thank you for your answer! I guess, then, that i have to make a wizard/popup appear when the option is clicked? I was looking for a way to directly call a server-side method, but I think I can cope with that anyway. Thank you again.

Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Button to open form. V11 Solved
action buttons odoov11
Avatar
Avatar
2
mar. 19
3802
How to add an header section in a tree view? Solved
header tree_view odoov11
Avatar
Avatar
1
okt. 18
8876
How to let a dopdown option appear only in tree-view or only in form-view? Solved
action views drop_down odoov11
Avatar
Avatar
1
dec. 22
5817
Need Advice For Migrate Thousands of Messy SKUs
action
Avatar
0
nov. 25
8
Pickup Date for E-Commerce Solved
action
Avatar
Avatar
Avatar
2
nov. 25
157
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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