Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

Inheriting notebook Tree View

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
viewinheritancenotebook
2 Replies
6463 Rodiniai
Portretas
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
Portretas
Atmesti
Portretas
nickchacha@gmail.com
Autorius Best Answer

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
Portretas
Atmesti
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
Autorius

Hi Jack,

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

Thanks alot

Portretas
Jack Dane
Best Answer

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
Portretas
Atmesti
nickchacha@gmail.com
Autorius

Thanks a batch @jack. Let me try and revert

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

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

Registracija
Related Posts Replies Rodiniai Veikla
View inheritance Solved
view inheritance
Portretas
Portretas
1
kov. 20
4402
How do I remove fields from a view in a custom module? Solved
view inheritance
Portretas
Portretas
Portretas
Portretas
12
gruod. 18
36247
Weird error "Expression cannot be located in parent view" in view inheritance Solved
view inheritance
Portretas
Portretas
1
liep. 16
7950
Two-level view inheritance, what am I missing?
view inheritance
Portretas
Portretas
2
kov. 15
6893
view inheritance in openerp
view inheritance
Portretas
Portretas
1
kov. 15
4373
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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