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 do you make new menu items and attach them to models,views & actions?

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
1 Odpowiedz
9798 Widoki
Awatar
Yenthe Van Ginneken (Mainframe Monkey)

Hey everybody

How exactly do you make new menu items and attach them to the models/views?
I'm looking into writing my own modules and customizing existing ones. The problem is that the little documentation that there is doesn't help me any further.. (for example https://www.odoo.com/documentation/8.0/howtos/backend.html )

Could anybody explain me how to do the following things?

  • Make a new menu item in a module
  • How to add custom strings to this (for example an item name with the name 'Documents'
  • How to add a view to it
  • How to customize this view
  • ...

I'd really like to know how the flow is and how everything works.
I tried to make a new menu item but I couldn't get anything working.
<record model="ir.actions.act_window" id="an_id_thats_linked_somewhere">
    <field name="name">My custom module name</field>
    <field name="res_model">ir.attachment</field><
    <field name="view_mode">tree,form</field>
</record>

Could anybody explain this some more and give a demo for example? There is by far to little documentation about this..
I'm trying to find out what refers to what and how you connect everything together. I am trying to add a new menu item in the module "Projects" and then show all attachments from all projects.

With kind regards
Yenthe

1
Awatar
Odrzuć
Awatar
Baiju KS
Najlepsza odpowiedź

First of all you have to define a new Object. You can do that by adding your custom module.

Eg for new object:- file is " custom_test.py"

from osv import osv,fields
from openerp.tools.translate import _


class custom_class(osv.osv):
    _name='custom.class'
    _columns={
              'names' : fields.char('Name', size=128, required=True),
              'class' : fields.char(string='Class', required=True),
              'code' : fields.char(string='Code'),
              }
    
custom_class()

 

class custom_subject(osv.Model):
    _name = "custom.subject"
    _description = "Subjects"
    _columns = {
        'name': fields.char('Name', size=64, required=True),
        'code': fields.char('Code', size=12, required=True),
        'maximum_marks': fields.integer("Maximum marks", size=5),
        'minimum_marks': fields.integer("Minimum marks", size=5),
        'weightage': fields.integer("Weightage", size=10),
        'is_practical':fields.boolean('Is Practical', help='Check this if subject is practical.'),
        'no_exam' : fields.boolean("No Exam", help='Check this if subject has no exam.'),

    }
custom_subject()

 

Then you have to define your view  file

Steps to add menu item:-

1. define your menu item

      Eg:

        <menuitem   icon="terp-project" id="my_test_menu"   name="My Test" sequence="4" action="action_my_form"/>

**This is your main menu item that shows in your tab

2. define your action

Eg:

        <record model="ir.actions.act_window" id="action_my_form">
            <field name="name">Class</field>
            <field name="res_model">custom.class</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="my_test_form" />
            <field name="view_mode">tree,form</field>
        </record>


**here i defined action for my main menu item and specified its view types

3. then you can link your views to action

Eg:

        <record id="action_my_form_tree" model="ir.actions.act_window.view">
            <field name="view_mode">tree</field>
            <field name="view_id" ref="my_test_tree"/>
            <field name="act_window_id" ref="action_my_form"/>
        </record>


**here i linked my tree view to action, you can link your each view like this,ie form,search etc....

 

 

My custom view file "custom_test_view.xml" as follows:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

    
         <record model="ir.ui.view" id="my_test_form">
            <field name="name">my.test.form</field>
            <field name="model">custom.class</field>
            <field name="arch" type="xml">
            <form string="Class Information" version="7.0">
                   <sheet>
                        <group col="4" colspan="4">
                            <field name="names" />
                            <field name="class" />
                            <field name="code" />
                        </group>
                    </sheet>
            </form>
         </field>
      </record>
    
    
        <record model="ir.ui.view" id="my_test_tree">
            <field name="name">my.test.tree</field>
            <field name="model">custom.class</field>
            <field name="arch" type="xml">
                <tree string="Class">
                    <field name="class"/>
                    <field name="code"/>
                </tree>
            </field>
        </record>
                            
       
       
       
        <record model="ir.ui.view" id="view_custom_subject_form">
            <field name="name">custom.subject.form</field>
            <field name="model">custom.subject</field>
            <field name="arch" type="xml">
                <form string="Subjects" version="7.0">
                    <sheet>
                        <group col="4" colspan="4">
                            <field name="name" placeholder="Name"/>
                            <field name="code" placeholder="Code"/>
                            <field name="maximum_marks" />
                            <field name="minimum_marks" />
                            <field name="weightage" />
                            <field name="is_practical"/>
                            <field name="no_exam"/>
                        </group>

                    </sheet>
                </form>
            </field>
        </record>
       
        <record model="ir.ui.view" id="view_custom_subject_tree">
            <field name="name">custom.subject.tree</field>
            <field name="model">custom.subject</field>
            <field name="arch" type="xml">
                <tree string="Subjects">
                    <field name="name"/>
                    <field name="code"/>
                    <field name="maximum_marks"/>
                    <field name="minimum_marks"/>
                    <field name="weightage"/>
                    <field name="no_exam"/>
                </tree>
            </field>
        </record>
       
       
       
               
        <record model="ir.actions.act_window" id="action_my_form">
            <field name="name">Class</field>
            <field name="res_model">custom.class</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="my_test_form" />
            <field name="view_mode">tree,form</field>
        </record>
       
        <record id="action_my_form_tree" model="ir.actions.act_window.view">
            <field name="view_mode">tree</field>
            <field name="view_id" ref="my_test_tree"/>
            <field name="act_window_id" ref="action_my_form"/>
        </record>
       
        <record model="ir.actions.act_window" id="action_subjects_form">
            <field name="name">Subjects</field>
            <field name="res_model">custom.subject</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_custom_subject_form"/>
            <field name="view_mode">tree,form</field>
        </record>
       
        <record id="action_view_custom_subjects_tree" model="ir.actions.act_window.view">
            <field name="view_mode">tree</field>
            <field name="view_id" ref="view_custom_subject_tree"/>
            <field name="act_window_id" ref="action_subjects_form"/>
        </record>
       
       
        <record id="action_view_custom_subjects_form" model="ir.actions.act_window.view">
            <field name="view_mode">form</field>
            <field name="view_id" ref="view_custom_subject_form"/>
            <field name="act_window_id" ref="action_subjects_form"/>
        </record>
       
       
             
    
        <menuitem
            icon="terp-project" id="my_test_menu"
            name="My Test" sequence="4"
            action="action_my_form"/>
                                                
        <menuitem
            name="Subjects" parent="my_test_menu"
            id="menu_subjects"
            sequence="2"/>
        
        <menuitem name="Subjects Details" parent="menu_subjects"
            id="menu_sub_subject" action="action_subjects_form"/>
                        
    </data>
</openerp>


For any assistance feel free to  baijuks@hotmail.com

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

Thanks Baiju, this atleast gives me a good start.

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