Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consulting
    • Accounting Firm
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Solar Energy Systems
    • Shoe Maker
    • Serveis de neteja
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How to manage tree view inside a form view

Subscriure's

Get notified when there's activity on this post

This question has been flagged
treeviewone2manyformview
2 Respostes
29991 Vistes
Avatar
arthur

Hello, I am creating a custom form view for odoo stock.picking module

My xml file contains the following record:

<record id="raizs_stock_picking_form_view" model="ir.ui.view">
    <field name="name">raizs.stock.picking.form.view</field>
    <field name="model">stock.picking</field>
    <field name="priority" eval="20"/>
    <field name="arch" type="xml">
        <form string="Movimentos">
            <sheet>
                <group>
                    <field name="name"></field>
                    <field name="partner_id"></field>
                    <field name="state"></field>
                </group>
                <notebook>
                    <page string="Produtos" >
                            <field name="id" invisible="1"/>
                        <field name="move_lines" style="pointer-events:none;">
                            <tree create="false" edit="false" editable="bottom" options="{'no_open': True}">
                                    <field name="state" invisible="True"/>
                                    <field name="additional" invisible="
                                    <field name="is_initial_demand_editable" invisible="True"/>
                                    <field name="is_quantity_done_editable" invisible="True"/>
                                    <field name="has_move_lines" invisible="True"/>
                                    <field name="product_id" required="1" attrs="{'readonly': ['|', '&amp;', ('state', '!=', 'draft'),                                                 ('additional', '=', False), ('has_move_lines', '=', True)]}"/>
                                    <field name="product_uom_qty" string="Initial Demand" attrs="{'readonly':                                                 [('is_initial_demand_editable', '=', False)]}"/>
                                    <field name="quantity_done" string="Done" attrs="{'readonly': [('is_quantity_done_editable',                                                 '=', False)]}"/>
                                    <field name="product_uom" attrs="{'readonly': [('state', '!=', 'draft'), ('additional', '=', False)]}"                                             options="{'no_open': True, 'no_create': True}" string="Unit of Measure"                                             groups="product.group_uom"/>
                            </tree>
                    </field>
            </page>
        </notebook>
    </sheet>
</form>
</field>
  </record>


I am having two problems:

1. I am trying to prevent the clicking on the move_line tree lines from opening the form view, but it keeps opening.

2. I want to display this tree view on odoo app for android, but it keeps showing the move_line records as a kanban view, even if I didn't specify it.

How do I get these 2 points right?

Thank you!

0
Avatar
Descartar
Avatar
arthur
Autor Best Answer

Thanks to your answer @subbarao, Unfortunately, the changes  you mentioned didn't work for me =/

I will post my whole view to clarify things, but basically I created to two menuitems and two actions for them, that open the same list and form views, but with different domains.

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <menuitem
        id="raizs_receipt_root_menu"
        name="Recebimentos"
    />

<record id="raizs_stock_picking_form_view" model="ir.ui.view">
    <field name="name">raizs.stock.picking.form.view</field>
    <field name="model">stock.picking</field>
    <field name="priority" eval="20"/>
    <field name="arch" type="xml">
    <form string="Movimentos">
        <sheet>
            <group>
                <field name="name"></field>
                <field name="partner_id"></field>
                <field name="state"></field>
           </group>
           <notebook>
                <page string="Produtos" >
                    <field name="id" invisible="1"/>
                    <field name="move_lines">
                        <tree create="false" editable="bottom" options="{'no_open': True}">
                            <field name="state" invisible="True"/>
                            <field name="additional" invisible="True"/>
                            <field name="is_initial_demand_editable" invisible="True"/>
                            <field name="is_quantity_done_editable" invisible="True"/>
                            <field name="has_move_lines" invisible="True"/>
                            <field name="product_id" required="1" attrs="{'readonly': ['|', '&amp;', ('state', '!=', 'draft'),                             ('additional', '=', False), ('has_move_lines', '=', True)]}"/>
                            <field name="product_uom_qty" string="Initial Demand" attrs="{'readonly':                             [('is_initial_demand_editable', '=', False)]}"/>
                            <field name="quantity_done" string="Done" attrs="{'readonly': [('is_quantity_done_editable', '=',                             False)]}"/>
                            <field name="product_uom" attrs="{'readonly': [('state', '!=', 'draft'), ('additional', '=', False)]}"                             options="{'no_open': True, 'no_create': True}" string="Unit of Measure"                             groups="product.group_uom"/>
                            <button name="add_quantity_done" string="+" type="object"/>
                            <button name="remove_quantity_done" string="-" type="object"/>
                        </tree>
                    </field>
                </page>
                </notebook>
            </sheet>
         </form>
    </field>
</record>

<record id="raizs_stock_picking_tree_view" model="ir.ui.view">
    <field name="name">raizs.stock.picking.tree.view</field>
    <field name="model">stock.picking</field>
    <field name="arch" type="xml">
        <tree string="Movimentos">
            <field name="partner_id"></field>
            <field name="scheduled_date"></field>
            <field name="state"></field>
        </tree>
    </field>
</record>

<record model="ir.actions.act_window" id="action_raizs_today_receipts">
    <field name="name">Recebimentos de hoje</field>
    <field name="res_pmodel">stock.picking</field>
    <field name="view_model">tree,form</field>
    <field name="view_ids" eval="[(5, 0, 0),
            (0, 0, {'view_mode': 'tree', 'view_id': ref('raizs_stock_picking_tree_view')}),
            (0, 0, {'view_mode': 'form', 'view_id': ref('raizs_stock_picking_form_view')})]"
    />
    <field name="domain">
        [
            ('scheduled_date','&gt;=',(context_today().strftime('%Y-%m-%d'))),
            ('location_dest_id','=',38)
        ]
    </field>
</record>
<menuitem
    id="raizs_today_receipts_menu"
    parent="raizs_receipt_root_menu"
    action="action_raizs_today_receipts"
/>

<record model="ir.actions.act_window" id="action_raizs_late_receipts">
    <field name="name">Recebimentos atrasados</field>
    <field name="res_model">stock.picking</field>
    <field name="view_model">tree,form</field>
    <field name="view_ids" eval="[(5, 0, 0),
        (0, 0, {'view_mode': 'tree', 'view_id': ref('raizs_stock_picking_tree_view')}),
        (0, 0, {'view_mode': 'form', 'view_id': ref('raizs_stock_picking_form_view')})]"
    />
    <field name="domain">
    [
        ('scheduled_date','&lt;=',(context_today().strftime('%Y-%m-%d'))),
        ('location_dest_id','=',38)
    ]
    </field>
</record>
<menuitem
    id="raizs_late_receipts_menu"
    parent="raizs_receipt_root_menu"
    action="action_raizs_late_receipts"
/>

</odoo> 


0
Avatar
Descartar
Avatar
subbarao
Best Answer

solution for Point 1

edit="false"  you have to remove
create="false" if you use ting you can't able to add new lines only possible to edit the existing lines

<field name="move_lines" style="pointer-events:none;">
                            <tree create="false" editable="bottom" options="{'no_open': True}">
                                    <field name="state" invisible="True"/>
                                    <field name="is_initial_demand_editable" invisible="True"/>
                                    <field name="is_quantity_done_editable" invisible="True"/>
                                    <field name="has_move_lines" invisible="True"/>
                                    <field name="product_id" required="1" attrs="{'readonly': ['|', '&amp;', ('state', '!=', 'draft'),                                                 ('additional', '=', False), ('has_move_lines', '=', True)]}"/>
                                    <field name="product_uom_qty" string="Initial Demand" attrs="{'readonly':                                                 [('is_initial_demand_editable', '=', False)]}"/>
                                    <field name="quantity_done" string="Done" attrs="{'readonly': [('is_quantity_done_editable',                                                 '=', False)]}"/>
                                    <field name="product_uom" attrs="{'readonly': [('state', '!=', 'draft'), ('additional', '=', False)]}"                                             options="{'no_open': True, 'no_create': True}" string="Unit of Measure"                                            groups="product.group_uom"/>
                            </tree>
                    </field>


to reflect these changes you have inherit and add menu action of picking
form view_id = raizs_stock_picking_form_view
0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
How to repeat basic mechanism for deleting lines inside form view.
treeview one2many delete formview
Avatar
Avatar
1
de gen. 23
2778
In one to many relation each many record having one more one to many relation... how can i show those data(one more one to many Solved
treeview one2many repeatin formview
Avatar
Avatar
Avatar
Avatar
3
de des. 23
24090
From tree view to dynamic form view
treeview formview
Avatar
Avatar
1
de set. 23
5314
how to add a button in a one2many tree view Solved
treeview one2many
Avatar
Avatar
Avatar
Avatar
Avatar
4
de des. 23
18589
Display One2many field value in tree view (Odoo 9)
treeview one2many
Avatar
Avatar
1
de set. 16
8054
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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