Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

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

Subscriure's

Get notified when there's activity on this post

This question has been flagged
odoo8
2 Respostes
7763 Vistes
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
Descartar
Avatar
SonnyV
Autor 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
Descartar
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
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
Selecting items for one2many relation Solved
odoo8
Avatar
Avatar
Avatar
2
de des. 22
15792
How to upload files automatically on attachments on button click ?
odoo8
Avatar
Avatar
1
de nov. 21
5896
Field company_registry missing in partner table
odoo8
Avatar
0
de gen. 21
3050
How I disable Import Button for certain model in odoo8? Solved
odoo8
Avatar
Avatar
Avatar
Avatar
Avatar
8
de maig 20
8873
why blank page with top menu only visible after login? odoo 8
odoo8
Avatar
0
de des. 23
3605
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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