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

Button That redirect to new form

Subscriure's

Get notified when there's activity on this post

This question has been flagged
buttonsformsredirectodooV12
2 Respostes
10387 Vistes
Avatar
Ali Mahmoud

Hi, 

i have a model called shift with status field, it can be open or closed, and it has a field called closing balance 

i want to create a button (close shift) that will be shown in tree view of the shifts, and when i click on it i should go to a form that will ask me to fill closing balance for this shift and when i click save the status of the shift will be changed to closed

Any when can help me please or give some guidelines for how to create this form and button and i will be thankful 

2
Avatar
Descartar
Avatar
Vishnu Vanneri
Best Answer
Please try this

@api.multi

def close_shift(self):

name = _('Close Shift')

view_mode = 'tree,form'

return {

'name': name,

'view_type': 'form',

'view_mode': view_mode,

'res_model': 'Your Model Name',

'type': 'ir.actions.act_window',

'target': 'current',

}

if you want to specify which shift then you can pass it by res_id tag in it.
1
Avatar
Descartar
José Moreno Hanshing

Hello, I am getting the following error in V13

werkzeug.exceptions.BadRequest: 400 Bad Request: <function Home.web_client at 0x7f1fb58217b8>, /web: Function declared as capable of handling request of type 'http' but called with a request of type 'json'

My function is

def open_child(self):

return {

'type': 'ir.actions.act_window',

'name': 'Child',

'view_type': 'form',

'res_model': self._child_model,

'res_id': self._child_id,

'view_mode': 'form',

'views': [(False,'form')],

'target': 'current',

}

Can you help me with this please?

Vishnu Vanneri

Did you applied @api.multi decorator in open_child function?

José Moreno Hanshing

That decorator does not exist in V13, but I will try to debug around that to see what "self" actually is

Vishnu Vanneri

Are you accessing through controller?.

José Moreno Hanshing

@Vishnu Vanneri well it turned out to be a logic error on my side. The self._child_id and model were not set and I was hiding the button with the opposite logical rule. After using the button on the correct records it works fine. Thanks your your reply :)

Avatar
Thayif kabir
Best Answer

Hi Ali,

You can return action in your button and redirect it any form view you want,

for example refer this code


return {             'name': 'name',
                    'view_type': 'form',
                    'view_mode': 'form',
                    'view_id': [res_id],
                    'res_model': 'model_id',
                    'context': "{}",
                    'type': 'ir.actions.act_window',
                    'nodestroy': True,
                    'target': 'current',     
                     }
pass the view_id to load specific form. if you need a pop up window you can give target = 'new'.
0
Avatar
Descartar
Ali Mahmoud
Autor

Thanks but what do you mean by inv_id? what does it represent ?

Thayif kabir

I've updated my answer, res_id is used when you need load a specific record in that model. You can pass model_id as res_id if you want to load a specific model

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
Make 'continue' button used at each kanban step in form Solved
buttons kanban forms v14
Avatar
Avatar
2
de febr. 21
3182
How to create the action of the buttons Odoo Community Version 12 ? Solved
action xml urgent buttons odooV12
Avatar
1
d’abr. 19
12415
"Starting a business and looking for a free form builder - any recommendations?"
forms
Avatar
Avatar
1
de juny 24
3638
Data Exceeded error while importing data in Odoo v12 Solved
odooV12
Avatar
Avatar
Avatar
Avatar
Avatar
4
de maig 24
8278
Redirect /jobs page not working
redirect
Avatar
Avatar
1
d’abr. 24
2834
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