Skip to Content
Odoo Menu
  • Sign in
  • 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
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

[ODOO8] Show save/cancel button in new window-action

Subscribe

Get notified when there's activity on this post

This question has been flagged
odoo8
2 Replies
7762 Views
Avatar
SonnyV

Hello fellow odooers

I have a module which calls a method, this method returns a window-action of sale.order's default form-view. The target I use is 'new'. The sale_order gets opened in an editable window, but no button (save/cancel) shows up. The button confirm order, send order etc shows up, but I do not need those buttons at this stage. I'd just like to be able to save my sale_order in the state that I edited it.

Another option for me would be to use the target 'current', but then my new sale_order would not be in edit mode. I have been looking in web's view_form.js and found the method 'to_edit_mode', but I am unsure on how to implement it in my python code to be able to start the view in edit-mode

The option 'inline' also starts in edit mode, but does not show the save/cancel buttons either.

Any help on this would be greatly appreciated.


EDIT: I have tried to install a module referenced in this topic: https://www.odoo.com/fr_FR/forum/help-1/question/closed-open-a-form-in-a-specified-state-edit-browse-3447 , But this module does not do anything. I have tried printing in the beginning of this js file, but with no luck.

So currently I have 3 options: 
1) Use target: new, which opens a wizard-like window in edit mode, without the option to save.
2) Use target: inline, which opens a form-view in edit mode, without the option to save.
3) Use target: current, which opens a form-view in view-mode, so I would have to click 'Edit'

The last option is preferred, but it would be perfect if this view could be opened in edit-mode. I tried adding the class oe_form_button_edit to my button (this class triggers edit-mode on click) but am unable to start my view in edit mode.


EDIT2: #openobject at freenode mentioned that a similar question was asked on the mailing list, so I started digging here and found a possible solution. I haven't had the time to figure it out, but I will try this soon and update this post.

https://www.odoo.com/nl_NL/groups/community-framework-62/community-framework-16152974?mode=thread&date_begin=&date_end=

1
Avatar
Discard
Avatar
SonnyV
Author Best Answer

The answer on how to open a wizard or a window-action in edit mode:

https://www.odoo.com/nl_NL/groups/community-framework-62/community-framework-16152974?mode=thread&date_begin=&date_end=  

This link references an example where the dictionary 'flags' is passed in the result-dictionary. After adding this to my return-statement, the view opens in edit mode! Hurray

flags = {'initial_mode': 'edit'}

return {     'type': 'ir.actions.act_window',     'view_type': 'form',     'view_mode': 'form,tree',     'res_model': 'sale.order',     'res_id': new_order.id,     'context': ctx,     'target': 'current',     'flags': flags,     # optionally, you could refine by specifying 'views' explicitly. False means 'use default view for model'     'views': [(False, 'form'), # open default form view first,               (False, 'tree')] # then default tree view }

2
Avatar
Discard
Avatar
Cuauhtémoc Díaz Minor
Best Answer

Hi, i had the same issue!

well the solution is add flags= {'action_buttons': True}

flags = {'action_buttons': True}
 return {
  'name':'Suppliers',
  'view_mode': 'form',
  'view_type': 'form',
  'views':[(False, 'form')],
  'res_model': 'res.partner',
  'type': 'ir.actions.act_window',
  'view_id': view_id,
  'target': 'new',
  'context': context,
  'flags': flags,
  }

hope this help you!

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

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

Sign up
Related Posts Replies Views Activity
Selecting items for one2many relation Solved
odoo8
Avatar
Avatar
Avatar
2
Dec 22
15792
How to upload files automatically on attachments on button click ?
odoo8
Avatar
Avatar
1
Nov 21
5896
Field company_registry missing in partner table
odoo8
Avatar
0
Jan 21
3049
How I disable Import Button for certain model in odoo8? Solved
odoo8
Avatar
Avatar
Avatar
Avatar
Avatar
8
May 20
8869
why blank page with top menu only visible after login? odoo 8
odoo8
Avatar
0
Dec 23
3605
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