Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to open a record in new tab with a context ?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
newtabcontexturlopenv15
5 Răspunsuri
5608 Vizualizări
Imagine profil
Dilaw bedj

Hi , please i want to know how to open a form view of another model on a new tab of the the browser by clicking on a button and passing it context

0
Imagine profil
Abandonează
Imagine profil
Yahoo Baba Innovations Pvt.Ltd
Cel mai bun răspuns

Hi  Dilaw Bej ,


It will open a new window or tab with the URL provided in the link. Here is a slightly refined version:

return {
​ 'name': 'Go to New Window',
​ 'res_model': 'ir.actions.act_url', 'type': 'ir.actions.act_url', 'url': link, # Your URL here
  ​ 'context': context, 'target': 'new', # Opens in a new window/tab }

A few things to note:

  • 'res_model': 'ir.actions.act_url' is not needed. The 'type': 'ir.actions.act_url' already specifies that it's a URL action.
  • 'context': ctx is not required unless you specifically need to pass context for this URL. If you need it, ensure that ctx is defined beforehand. If not, you can remove this part.

Let me know if you need further modifications!


Thank you

1
Imagine profil
Abandonează
Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns

Hi,

Let's say you have a model called model1 and you want to open a form view of another model model2 in a new tab when a button is clicked. Here are the steps:

add a button to trigger the action:

<record id="view_my_model_form" model="ir.ui.view">
    <field name="name">my.model.form</field>
    <field name="model">my.model</field>
    <field name="arch" type="xml">
        <form>
            <!-- Your existing fields go here -->
            <footer>
                <button string="Open Other Model" class="oe_highlight" type="object" name="open_other_model"/>
            </footer>
        </form>
    </field>
</record>


python :

from odoo import models, fields, api

class MyModel(models.Model):
_name =model1'

# Your existing fields go here

@api.multi
def open_other_model(self):
    # You can pass context by defining a dictionary
    context = {
        'default_field_name': 'default_value',
        'additional_context_key': 'additional_context_value',
    }

    # Open the form view of the other model in a new tab
    return {
        'name': 'Other Model Form',
        'type': 'ir.actions.act_window',
        'res_model': 'model2',
        'view_mode': 'form',
        'view_id': self.env.ref('other_module.view_other_model_form').id,  # Replace with the actual view ID
        'target': 'new',
        'context': context,
    }


Create model 2 Python and xml files 


Hope it helps

1
Imagine profil
Abandonează
Imagine profil
SunArc Technologies
Cel mai bun răspuns

Hi,

You can open record in new tab with below code if your problem still not fixed.

class YourClass1(models.Model):

    _name = 'model1'

   

    def action_open_record_new_tab(self):

        record_id = # define your record id to open record

        model = 'model2'  # Replace with the actual model name

        # Construct the URL to open the record in a new tab

        url = '/web#id=%s&model=%s' % (record_id, model)

        # You Can add context for passing values

​context = {

​ }

        # Redirect to the URL

        return {

            'type': 'ir.actions.act_url',

            'url': url,

            'target': 'new',  # Open in a new tab/window

            'context': context,

        }

 

In XML define button for method.


Thanks

0
Imagine profil
Abandonează
Imagine profil
Sun Southern
Cel mai bun răspuns

if partner has already you can use below code:

base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') url = f"{base_url}/web#id={partner_Id}&model=res.partner&view_type=form"

return { 'type': 'ir.actions.act_url', 'url': url, 'target': '_blank' }

here is my code in odoo 17 model res.partner. hope it be can help you!

0
Imagine profil
Abandonează
Imagine profil
Dilaw bedj
Autor Cel mai bun răspuns

But in this case it will open the second model as a wizard/pop-up ans not in a browser's new tab

0
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Help ! How to open a view in new tab with context
newtab context open v15
Imagine profil
Imagine profil
1
ian. 24
3147
How to open a record in new tab with a context ?
newtab context record url open
Imagine profil
Imagine profil
1
ian. 24
2347
Odoo Window action apply multiple filters
context filters v15
Imagine profil
0
mar. 24
2444
Context group_by and order
context groupby v15
Imagine profil
1
oct. 22
4101
Odoo 15 - pre-fill field in one2many form
form context v15
Imagine profil
0
aug. 22
3944
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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