Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

How to navigate back in view history (SOLVED)

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
12 Besvarelser
15929 Visninger
Avatar
Pau Ubach

This question is related to:
https://www.odoo.com/forum/help-1/question/open-a-form-view-for-a-specific-record-or-go-back-to-previous-view-64998

When I'm navigating between views, in the header I can see this history:

Example: Opportunities / New oportunity / Administrator 
Clicking in New oportunity would navigate one view back, clicking in Opportunities would navigate 2 views back.

How can I do this automatically from a function in python? 

I have managed to create a new view, but can't go back to last view.

Thanks,
Pau

 

0
Avatar
Kassér
Avatar
Pau Ubach
Forfatter Bedste svar

I managed to solve it!! (where's the smiley of infinite happiness?)

I just navigate back in browser history.

For this I need to create an action: 

        <record model="ir.actions.client" id="action_client_back">
            <field name="name">instance.bdt.Back</field>
            <field name="tag">bdt.back</field>
            <field name="params">{}</field>
        </record>

and the JS function:

openerp.request_project = function(instance) {
    instance.request_project = {};
    instance.request_project.back = function(){
        window.history.back();
    };
    instance.web.client_actions.add('bdt.back', 'instance.request_project.back');
}

So, when I finish what button does I can return back:

return {'type': 'ir.actions.client', 'tag': 'bdt.back'}
2
Avatar
Kassér
Russell Briggs

And just to update this for odoo 16 (and probably above).

Add the following JS to your module:

```js
/** @odoo-module **/
import { registry } from '@web/core/registry';

async function goBack(env, action) {
env.services.action.restore();
}

registry.category('actions').add('history_back', goBack);
```

Now you can actually use the following in your python code

```python
return {'type': 'ir.actions.client', 'tag': 'history_back'}
```

Avatar
Zyphos
Bedste svar

To navigate back in history,

you don't need to create a new function. It is already in Odoo.

Just add at the end of your button python function:

return {'type': 'ir.actions.client', 'tag': 'history_back'}

0
Avatar
Kassér
Chandni Gandhi

Best. Thanks :)

Russell Briggs

FYI Tried this in Odoo 16 and it doesn't work

Avatar
Deepa Venkatesh
Bedste svar

If you are meaning, to load a particular action...

then in your return statement of the function, return the action / ir_act_window...

Example:

model_obj = self.pool.get('ir.model.data')
        
form_view = model_obj._get_id(cr, uid, 'MODULE_NAME', 'XML_VIEW')
if form_view:
            form_view = model_obj.browse(cr, uid, form_view, context=context).res_id

return {
                    'view_type' : 'form',
                    'view_mode' : 'form',
                    'res_model' : 'MODEL',
                    'res_id'    : False,
                    'view_id'   : False,
                    'views'     : [(form_view, 'form'), ],
                    'type'      : 'ir.actions.act_window',
                    'target'    : 'current',
                  }

You can also refer in standard, Invoice to Refund option as well, in which when an invoice is refunded, it loads action of Refunds...

0
Avatar
Kassér
Pau Ubach
Forfatter

Hi deep, thanks but I don't mean it. You can check the link to the other question.

Pau Ubach
Forfatter

Now I do as you described, and the problem is that I get a new element in the navigation history instead of deleting the last one.

Deepa Venkatesh

add reload: True in the value list

Deepa Venkatesh

'tag': 'reload',

Pau Ubach
Forfatter

Could you clarify last answer?

Deepa Venkatesh

If still the problem persists, then you can write you own widget to do the same....

Deepa Venkatesh

I didnt get... which one?

Pau Ubach
Forfatter

I tried reload, but it doesn't go to the previous view, it just refresh the new one.

Pau Ubach
Forfatter

Thanks anyway deep.

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

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

Tilmeld dig
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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