Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Inheriting notebook Tree View

Odebírat

Get notified when there's activity on this post

This question has been flagged
viewinheritancenotebook
2 Odpovědi
6535 Zobrazení
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
Zrušit
Avatar
nickchacha@gmail.com
Autor Nejlepší odpověď

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
Zrušit
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
Autor

Hi Jack,

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

Thanks alot

Avatar
Jack Dane
Nejlepší odpověď

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
Zrušit
nickchacha@gmail.com
Autor

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!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
View inheritance Vyřešeno
view inheritance
Avatar
Avatar
1
bře 20
4529
How do I remove fields from a view in a custom module? Vyřešeno
view inheritance
Avatar
Avatar
Avatar
Avatar
12
pro 18
36427
Weird error "Expression cannot be located in parent view" in view inheritance Vyřešeno
view inheritance
Avatar
Avatar
1
čvc 16
8073
Two-level view inheritance, what am I missing?
view inheritance
Avatar
Avatar
2
bře 15
6996
view inheritance in openerp
view inheritance
Avatar
Avatar
1
bře 15
4430
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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