Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

How can I use a search view into a view displayed by a button ?

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
actionviewsearchtreebutton
1 Odpowiedz
17861 Widoki
Awatar
PJ Soule

Hi everyone.

I'm new to OpenERP, and I experience some issue to display a view by clicking on a button from another view (creating an ir.action.act_window object). I can display the view that I want to, but the search view isn't available.

When I display the view from a menu link, no problem, my search view appears and is functional.

Here the XML for the tree I want to display and my search view :

<!-- Search view -->
     <record id="view_search_result_filter" model="ir.ui.view">
        <field name="name">Filtres des résultats</field>
        <field name="model">flights.result</field>
        <field name="arch" type="xml">
            <search string="Résultats">
                <group expand="1" string="Group By...">
                    <filter name="solu" string="Solution" domain="[]" context="{'group_by':'solution_name'}"/>
                    <filter name="traj" string="Trajet" domain="[]" context="{'group_by':'journey_name'}"/>
                </group>
            </search>
        </field>
    </record>

    <!-- Tree view -->
    <record id="flights_result_tree" model="ir.ui.view">
        <field name="name">flights.result.tree</field>
        <field name="model">flights.result</field>
        <field name="arch" type="xml">
            <tree string="Résultats">
                <field name="solution_name" invisible="1" />
                <field name="solution_number" invisible="1" />
                <field name="source" />
                <field name="airline" />
                <field name="fare" />
                <field name="fare_type" />
                <field name="private_fare" />
                <field name="journey_number" invisible="1"  />
                <field name="journey_name"  invisible="1" />
                <field name="alternative_number"  invisible="1" />
                <field name="alternative_name"  invisible="1" />
                <field name="alternative_departure_datetime" />
                <field name="alternative_arrival_datetime" />
                <field name="alternative_stops" />
                <field name="alternative_technical_stops" />
                <field name="alternative_departure_airport" />
                <field name="alternative_arrival_airport" />
          </tree>
        </field>
    </record>

And here is the code of the button which display my view :

def flight_open_results(self, cr, uid, ids, context=None):
    this = self.browse(cr, uid, ids, context=context)[0]
    tree_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'app_flights', 'flights_result_tree')[1]
    search_view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'app_flights', 'view_search_result_filter')[1]
    form_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'app_flights', 'flights_result_form')[1]

    res = {
        'type': 'ir.actions.act_window',
        'name': 'Résultats',
        'view_type': 'tree',
        'view_mode': 'tree,form',
        'res_model': 'flights.result',
        'domain':[('search_id','=',this.id)],
        'context':{'search_default_Current': 1, 'search_default_solu': 1, 'search_default_traj':1},
        'views': [(tree_id,'tree'),(form_id,'form')],
        'search_view_id': search_view_id
    }

    return res

And to finish, my menu link, which works well :

    <record model="ir.actions.act_window" id="action_flights_results">
        <field name="name">Résultats</field>
        <field name="res_model">flights.result</field>
        <field name="view_type">form</field>
        <field name="domain">[]</field>
        <field name="view_mode">form,tree</field>
        <field name="view_id" ref="flights_result_tree" />  
        <field name="context">{'search_default_Current': 1, 'search_default_solu': 1, 'search_default_traj':1}</field>
    </record>

    <menuitem name="Résultats"
        parent="menu_engine_flights"
        id="menu_engine_flights_results"
        action="action_flights_results"/>

As you see, I added a form view to make some tests, and :

  • From the "normal" view, opened with a menu link, everything works fine : I can click on a line, my form view shows, with controls to navigate between elements on the top of the page.

  • From the view opened from the button, when I click on a line of my tree, nothing happens. And when I switch to the form view, there is no record loaded and I don't have any navigation control, only the possibility to create a new record.

I think this is a lead to the answer, but I don't know OpenERP weel enough to find the solution. Could you help me with this please ?

Thank you.

1
Awatar
Odrzuć
Awatar
Andreas Brueckl
Najlepsza odpowiedź

In the return value of flight_open_results you should change the view_type from tree to form.

Also the view_mode ('tree,form') is different to that defined in action_flights_results ('form, tree').

2
Awatar
Odrzuć
PJ Soule
Autor

It works, thanks ! I'm really a newbie into the openERP world, and I dn't really understand why I have to call the form view to show the tree view, but though, it works, and that's all I needed. Thank you again !

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
button on top of tree view
v6.1 view tree button
Awatar
0
mar 15
5091
Regarding Tree View to Form View
action form view tree
Awatar
0
mar 15
4594
"Search More..." in many2one field Rozwiązane
view many2one search tree more
Awatar
Awatar
Awatar
Awatar
Awatar
4
lis 24
22080
Disable Create button in Tree view but keep Import
import treeview view tree button
Awatar
0
lip 25
11946
Can we add a button between the search view and the tree?
search tree button between object
Awatar
0
mar 15
4332
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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