Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

Inheriting notebook Tree View

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
viewinheritancenotebook
2 Risposte
6537 Visualizzazioni
Avatar
nickchacha@gmail.com

Am seeking for your assistance on a slight challenge in view inheritance

There's a tree-view inside a notebook and that would like to add more fields to.

I have already inherited the main-view as shown below but i can't seem to get the new fields on the mentioned tree-view. 


Here's what i have so far and has failed. 
Disclaimer:  Am newbie so go 'hard' on me

        
            <field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<!-- <xpath expr="//notebook/page[2]/tree/field[@name='lot_id']" position="after">-->
<!-- <field name="gross_weight"/>-->
<!-- <field name="tare_weight"/>-->
<!-- <field name="moisture_cont" />-->
<!-- </xpath>-->

<notebook position="inside">
<page string="Detailed Operations" attrs="{'invisible': ['|', ('show_operations', '=', False), ('show_reserved', '=', False)]}">

<xpath expr="page[2]" position="inside">
<field name="move_ids_without_package" position="after">
<xpath expr="//tree/field[@name='lot_id']" position="after">
<field name="gross_weight"/>
<field name="tare_weight"/>
<field name="moisture_cont" />
</xpath>

</field>

</xpath>
</page>

</notebook>
</field>
        
0
Avatar
Abbandona
Avatar
nickchacha@gmail.com
Autore Risposta migliore

After implementing @jack suggestion, i  have an error which. The view can no-longer find the already defined model fields. 

Below is the error.

Note: I have a model file which is inheriting the same model as the view and the 'missing' field is already defined there. 

Advanced apologies if am asking the obvious but apparently, i can't seem to figure this one out

Thanks

 <?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>

<record id="picking_orders_additions" model="ir.ui.view">
<field name="name">liroi_fields.picking_orders_additions</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">


<xpath expr="//field[@name='move_ids_without_package']/tree[1]" position="inside">
<field name="gross_weight"/>

</xpath>

</field>


</record>

</data>
</odoo>



# -*- coding: utf-8 -*-

from odoo import models, fields


class PickingOrdersFields(models.Model):
_inherit = 'stock.picking'

gross_weight = fields.Float(
string='Gross Weight',
# related='delivery_id.weight',
)
tare_weight = fields.Float(
string='Tare Weight',
# related='delivery_id.weight',
)
moisture_cont = fields.Float(
string='Moisture Content',
# related='delivery_id.weight',
)
0
Avatar
Abbandona
Jack Dane

Hello,

Just to check is the "gross weight" field defiantly a field which is located in the model "lot_id"?

Could you share the Python code which extends the model?

Thanks,

Jack Dane

Another good way to check if the field exists is to go to settings->technical->models and search for the lot_id model. From here you will see all the fields in this model.

nickchacha@gmail.com
Autore

Hi Jack,

Please see the edited content for both the view and corresponding .py file

Thanks alot

Avatar
Jack Dane
Risposta migliore

Hello,

There are quite a few things wrong here, but I will try and help you best I can. Your first attempt (commented) looks promising. We all start somewhere.

Below is an example where you would have a One2many with a student model and you would like to add the last_name field to the tree view (it only has the first_name defined so far). 

If the form view is displayed as something like:

<field name="student_id"> 
    <tree>
        <field name="first_name"/>
    </tree>
</field>

You would inheirt the view like you have done and then add the field using the xpath. The expression would be:

<xpath expr="//field[@name='student_id']/tree[1]" position="inside">
    <field name="last_name"/>
</xpath>

This has added the field last_name from the Student model into the One2many.

I hope this helps if you need anything clarifying feel free to email/comment.

BTW I believe the notepad doesn't really matter as long as you start with //field_name

Thanks, 

0
Avatar
Abbandona
nickchacha@gmail.com
Autore

Thanks a batch @jack. Let me try and revert

Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
View inheritance Risolto
view inheritance
Avatar
Avatar
1
mar 20
4531
How do I remove fields from a view in a custom module? Risolto
view inheritance
Avatar
Avatar
Avatar
Avatar
12
dic 18
36429
Weird error "Expression cannot be located in parent view" in view inheritance Risolto
view inheritance
Avatar
Avatar
1
lug 16
8074
Two-level view inheritance, what am I missing?
view inheritance
Avatar
Avatar
2
mar 15
6997
view inheritance in openerp
view inheritance
Avatar
Avatar
1
mar 15
4431
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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