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 to make two different listviews from the same model in a module?

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
2 Odpowiedzi
8033 Widoki
Awatar
Yenthe Van Ginneken (Mainframe Monkey)

Hi everybody

I want to extend the project module and make a new menu item that shows the project.project data in a listview but with other fields.
The default project listview looks like this:
http://i.imgur.com/II0O8PW.png

I now want to create a second menu item that also shows a listview but with other field names. It should show me the name and some of my custom fields (such as x_internal_ip and x_external_ip).
How exactly should I do this? I've coded the second menu-item and the view but if I change the fields in the arch of project.project it reflects on both the project.project views that I now have.

My custom code:

<!--CUSTOM-->
    <record id="project_detail_tree" model="ir.ui.view">
            <field name="name">Details</field>
            <field name="model">project.project</field>
            <field name="arch" type="xml">
                <tree string="Details">
                    <field name="x_name"/>
            <field name="x_number"/>
            <field name="x_vm_name"/>
            <field name="x_internal_ip"/>
            <field name="x_external_ip"/>
            <field name="x_port"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="course_search_view">
            <field name="name">project.project.search</field>
            <field name="model">project.project</field>
            <field name="arch" type="xml">
                <search>
                    <field name="name"/>
                </search>
            </field>
        </record>

        <record model="ir.actions.act_window" id="project_course_action">
            <field name="name">Details overview</field>
            <field name="res_model">project.project</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        <field name="arch" type="xml">
                <search>
                    <field name="name"/>
                </search>
                </field>
        </record>

        <menuitem id="detail_menu" name="Details specifications" parent="base.menu_main_pm" />
        <menuitem id="project_details_menu" name="Details configuration" parent="detail_menu" action="project_course_action" />

The thing is that my code from project.project.tree is combined with the code of the default project.project tree code there is, which looks like this:

<record id="view_project" model="ir.ui.view">
            <field name="name">project.project.tree</field>
            <field name="model">project.project</field>
            <field name="field_parent">child_ids</field>
            <field name="arch" type="xml">
                <tree fonts="bold:message_unread==True" colors="red:date and (date&lt;current_date) and (state == 'open');blue:state in ('draft','pending');grey: state in ('close','cancelled')" string="Projects">
                    <field name="sequence" widget="handle"/>
                    <field name="message_unread" invisible="1"/>
                    <field name="date" invisible="1"/>
                    <field name="name" string="Project Name"/>
                    <field name="user_id" string="Project Manager"/>
                    <field name="partner_id" string="Contact"/>
                    <field name="parent_id" string="Parent" invisible="1"/>
                    <field name="planned_hours" widget="float_time"/>
                    <field name="total_hours" widget="float_time"/>
                    <field name="effective_hours" widget="float_time"/>
                    <field name="progress_rate" widget="progressbar"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

What is the solution to make a second view with data from project.project in a second tree view?

Thanks
Yenthe

0
Awatar
Odrzuć
Awatar
Bole
Najlepsza odpowiedź

You can find good example for similar thing in account module.. 
Check account_invoice_view.xml.... 
there is invoice_form and invoice_supplier_form views both "sitting" on same model.. 
Trick is to define separate actions , and in them define wich view should they call.. 

Take a closer look and apply to your models :) 
I see you are quite experienced, so no need for noob-like step-by-step expanation.. 

also.. hope this will help you a bit : )

 

0
Awatar
Odrzuć
Yenthe Van Ginneken (Mainframe Monkey)
Autor

@Bole, thanks for the reply! Sadly I can't seem to find my error. I know it has to do with the view it should call and the correction references but I just can't find what I'm doing wrong! Care to take a look at it and give me a bit more guidance? Looks like I'm missing something vital here.

Awatar
Ivan
Najlepsza odpowiedź

Yenthe, you need 2 actions in this case.  Within each action you can specify which views to use.  Bole has pointed out a good example file in ir.actions.act_window.view.  Search for "ir.actions.act_window.view" in that file for samples.

0
Awatar
Odrzuć
Yenthe Van Ginneken (Mainframe Monkey)
Autor

@John, thanks for the reply and some extra guidance! What I don't understand is why these two views interfere with eachother? I'm really missing the logic of this. Could you help me any further and give me a little sample or something? I'm really not sure about what to do. There are like three tree views in the sample too. :/

Ivan

Yenthe, when Odoo executes a window action that does not specify any specify view, it will search for a view of that model and the requested type (tree, form, etc.) based on the order of priority and name. So, the higher the priority (the smaller the number), the more chance it will be picked up if a view is requested without specifying which specific one. The same goes for the name order if you have multiple views with the same priority. I'm not too sure what is the behaviour if you have multiple valid views with the same priority and name.

Ivan

One more thing that you might have known before: trace the XML ids to see which view is used by which action.

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ę
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