Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to add a field to existing tree view?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
viewscodefieldsinheritOdooV13
1 Răspunde
7519 Vizualizări
Imagine profil
asma@alhadargroup.com

Hello,

 I want to add a field which is found in the inventory overview delivery orders, if you open a form (stock.picking) you will find detailed operation notebook page which contains the quantity done field. I want to add this field to the tree view of (stock.picking).


I tried to add it to the view but it says that it doesn't contain this field. Is there any solution. Waiting for a reply!


Thanks in advance!

0
Imagine profil
Abandonează
Thomas Guénard

use studio app

Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns

Hi,

Please try this code:

In this, we have created a new field that works according to the given compute function. It will traverse the lines of the notebook and calculate the quantity. Then this field can be used directly in the tree view.

Python Code

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

total_quantity_done = fields.Float(
'Total Quantity Done', compute='_total_quantity_done_compute',
digits='Product Unit of Measure')

@api.depends('move_line_ids_without_package.qty_done',
'move_line_ids.product_uom_id')
def _total_quantity_done_compute(self):
for rec in self:
rec.total_quantity_done = 0.00
if rec.move_line_ids_without_package:
for line_ids in rec.move_line_ids_without_package:
rec.total_quantity_done += line_ids.qty_done

XML Code

<?xml version="1.0" encoding="utf-8"?>


<odoo>


    <record id="stock_picking_view_form" model="ir.ui.view">


        <field name="name">stock.picking.view.form.inherit.mrp_ext</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='backorder_id']"


                   position="after">


                <field name="total_quantity_done"/>


            </xpath>


        </field>


    </record>




    <record id="stock_picking_view_tree" model="ir.ui.view">


        <field name="name">stock.picking.view.tree.inherit.mrp_ext</field>


        <field name="model">stock.picking</field>


        <field name="inherit_id" ref="stock.vpicktree"/>


        <field name="arch" type="xml">


            <xpath expr="//field[@name='origin']"


                   position="after">


                <field name="total_quantity_done"/>


            </xpath>


        </field>


    </record>


</odoo>


Regards

0
Imagine profil
Abandonează
Cybrosys Techno Solutions Pvt.Ltd

Hi,
Consider the below case also
‘quantity_done’ field is defined in ‘stock.move’ and odoo connects through relation field (‘one2many
So you cannot define the field in tree view which is not present in ‘stock.picking’ model.
It’s not a good idea to compute the value from ‘stock.move’ to a custom field which is defined in stock.picking because there many have multiple products with done quantities in one2many.

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

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Many2many fields Rezolvat
domain code fields OdooV13
Imagine profil
Imagine profil
2
mar. 23
4488
Odoo 10 - Inherited template field appears depends upon position Rezolvat
views fields inherit odoo10
Imagine profil
Imagine profil
2
mar. 18
5448
Issue When Inheriting res.partner - Build Fails on Odoo.sh
code inherit
Imagine profil
Imagine profil
1
aug. 25
2115
How to use a new field added in a inherited model into a view?
views inherit
Imagine profil
Imagine profil
Imagine profil
3
aug. 22
12832
Why does the custom view code doesn't show up? Rezolvat
views inherit
Imagine profil
Imagine profil
Imagine profil
2
feb. 19
4924
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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