Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

How to "postion=replace" a Form or Tree View, Menuitem ?

Odoberať

Get notified when there's activity on this post

This question has been flagged
formmenuitemtreenew
2 Replies
9740 Zobrazenia
Avatar
Ruban Kannan

Hello everyone, 

I want to list all the product template colums (39 columns I see in pgadmin) in the Product template Form view. Adding position="replace" for fields does not work for me since I want to see all the colums.

I want to know how I can replace the existing menuitem,action and views with the new items I created. Also, how can I inject new menuitem,action and views. Below is my XML content. 

<record id="product_vape_form_view" model="ir.ui.view">
            <field name="name">product.vape.form.view</field>
            <field name="model">product.template</field>
            <field name="arch" type="xml">
                <form>
                    <group>
                        <field name="warranty" />
                        <field name="uos_id" />
                        <field name="list_price" />
                        <field name="weight" />
                        <field name="color" />
                        <field name="image" />
                        <field name="write_uid" />
                        <field name="mes_type" />
                        <field name="uom_id" />
                        <field name="description_purchase" />
                        <field name="create_date" />
                        <field name="uos_coeff" />
                        <field name="create_uid" />
                        <field name="rental" />
                        <field name="product_manager" />
                        <field name="message_last_post" />
                        <field name="company_id" />
                        <field name="state" />
                        <field name="uom_po_id" />
                    </group>
                    <group>
                        <field name="type" />
                        <field name="description" />
                        <field name="weight_net" />
                        <field name="volume" />
                        <field name="write_date" />
                        <field name="active" />
                        <field name="categ_id" />
                        <field name="sale_ok" />
                        <field name="image_medium" />
                        <field name="name" />
                        <field name="description_sale" />
                        <field name="image_small" />
                        <field name="loc_rack" />
                        <field name="track_incoming" />
                        <field name="sale_delay" />
                        <field name="track_all" />
                        <field name="track_outgoing" />
                        <field name="loc_row" />
                        <field name="loc_case" />
                    </group>
                </form>
            </field>
        </record>
        <record id="product_vape_tree_view" model="ir.ui.view">
            <field name="name">product.vape.tree.view</field>
            <field name="model">product.template</field>
            <field name="arch" type="xml">
                <tree >
                    <field name="name" />
                    <field name="create_date"/>
                    <field name="create_uid"/>
                </tree>
            </field>
        </record>
        <record id="action_product_vape_tree_view" model="ir.actions.act_window">
            <field name="name">All Products</field>
            <field name="res_model">product.template</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="product_vape_tree_view"/>
        </record>
        <menuitem id="vape.product" action="action_product_vape_tree_view" name="All Vape Products" parent="base.menu_product" />

0
Avatar
Zrušiť
Avatar
Ivan
Best Answer

Ruben, aside from <record> tag, there is also <delete> tag.  Both works if you specify the XML ID (id) and model of the said attribute.  So, having said that:

  • You can delete a record by adding <delete id="the_xml_id_of_record_to_delete" model="the_model_to_delete/> somewhere in your XML
  • You can update a record by adding <record id = "the_xml_id_of_record_to_change" model="the_model_to_change"> ... </record>, where ... is the new content (list of fields and their values) of the record.  It will update the fields listed in the content.
  • If the record is created by other module you can specify the "full" XML ID: module_name.the_xml_id_of_record_to_change
  • Note that generally it is not advisible to change or delete a view as the view may be inherited by other modules. It is better to inherit a view instead.
  • To tie in a view to an action, you can specify it with the following XML snippet:
  • <record model="ir.actions.act_window.view" id="tie_in_view_to_action">
                <field name="sequence" eval="1"/>
                <field name="view_mode">form</field>
                <field name="view_id" ref="your_view_xml_id"/>
                <field name="act_window_id" ref="product_template_action_tree"/>
            </record>
1
Avatar
Zrušiť
Ruban Kannan
Autor

Note that generally it is not advisible to change or delete a view as the view may be inherited by other modules. It is better to inherit a view instead. /// Thanks. I completely agree with the last point and I want to proceed this way. So, 1. How do I bulk replace fields in an inherited view? 2. How do I add a new menu item under an existing menu item and open the newly created View?

Ivan

Menu will call an action (in this case, a window action). Window action will call a view. So, basically you need to do the following: - Inherit the view that you need to inherit. I am not aware of any way to bulk replace field. You can replace the form, I guess, but this will be quite similar as deleting the old view and creating a new one. - Create a new action window to using the new views that you have specified - Create a new menu whose parent is an old menu (specified by XML ID) and calling the new action that you have created. Check the account/account_view.xml for example. If you really need a different view from the original view, you can create (instead of inheriting or replacing) a new view and let the old view be.

Ruban Kannan
Autor

Thx John. I want to display my new action under Sales/Products underneath Sales/Products/Products by Category. I wrote my new action as . vape is my module name, base.menu_product seems to be the id of Sales/Products. It didn't work

Ruban Kannan
Autor

See the last line of my XML for the action I wrote.

Ruban Kannan
Autor

Sorry about the confusion. This works now. I didn't include the new XML file in my data of openerp.py.

Ruban Kannan
Autor

Thx for this. So this works when I add a new line (field name="sequence" eval="1") or (field name="priority" eval="1") to the form view xml. But, since it changes the priority, it changes the default Form view. While this is okay for me, I just want to know how to associate the my custom form view only to the custom tree view I created. In other words, how to trigger the custom form view when a record in tree view is clicked.

Ivan

Ruben, please refer to the last 2 points in this answer on how to tie in a view to an action.

Avatar
Ruban Kannan
Autor Best Answer

I was able to inject a new Menuitem with the following line

<menuitem id="vape.product" action="action_product_vape_tree_view" name="All Vape Products" parent="base.menu_product" />

I'm still wondering how to use my custom defined Form View in place of the default product template form view "product.product_template_only_form_view"

 

0
Avatar
Zrušiť
Ivan

Can't find product_template_only_form_view in my version of Odoo. Anyway, there are a couple of ways to achive that. First, the simplest one but no guarantee, is to set your custom view with a small priority. The view has a priority field in which a smaller priority (e.g. 1) will be picked first if there are more than one views defined for that model. Second, is to tie the action with the form view. In my version of Odoo, product.template is called by action with XML ID: product_template_action_tree. You can add the following record to tie in your view with this action: form

Ivan

Sorry the XML is not posted properly, I'll edit my previous answer.

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

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
Tree not showing "Add an item"
form tree
Avatar
Avatar
Avatar
Avatar
3
máj 20
8369
One model, two forms and trees, how to set this up?
developement form tree
Avatar
Avatar
Avatar
3
apr 24
2725
Make a boolean field editable in a tree view with the possibility of open a form view when clicking on a row ?? Solved
editable form tree
Avatar
Avatar
2
nov 18
14142
How to use two specific views (tree and form view) when using ir.actions.act_window Solved
form tree ir.actions.act
Avatar
Avatar
2
mar 16
8779
how to use tree in form view
form view tree
Avatar
Avatar
1
mar 15
8904
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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